linux ntp 本机同步,设置NTP服务器以允许本地计算机同步到Linux

我正在尝试设置一台机器作为ntp服务器,其他本地机器将与其同步.无论ntp服务器机器是否连接到互联网,都需要这样做,即:时间是否正确并且机器彼此同步并不重要.

我的配置文件如下:

NTP服务器/etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift

server 0.pool.ntp.org iburst

server 1.pool.ntp.org iburst

server 2.pool.ntp.org iburst

server 127.127.1.0

fudge 127.127.1.0 stratum 10

restrict -4 default kod notrap nomodify nopeer noquery

restrict -6 default kod notrap nomodify nopeer noquery

restrict 127.0.0.1

restrict ::1

NTP客户端/etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift

server 192.168.1.146 iburst

restrict -4 default kod notrap nomodify nopeer noquery

restrict -6 default kod notrap nomodify nopeer noquery

restrict 127.0.0.1

restrict ::1

我改变了服务器上的时间

然后我用sudo /etc/init.d/ntp start运行ntp服务器

并尝试测试客户端可以使用sudo ntpdate 192.168.1.146接收ntp更新

这是有效的,但只有在连接到Internet时(即使主设备的时间由我的命令设置而不是从外部ntp服务器设置).

我的配置文件中有什么错误吗?我失踪的任何一步?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值