我正在尝试设置一台机器作为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服务器设置).
我的配置文件中有什么错误吗?我失踪的任何一步?