4

我正在尝试设置一台机器作为 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

我更改服务器上的时间,然后运行 ​​ntp 服务器sudo /etc/init.d/ntp start 并尝试测试客户端是否可以接收 ntp 更新sudo ntpdate 192.168.1.146

这有效,但仅在连接到 Internet 时才有效(即使主服务器有我的命令设置的时间,而不是来自外部 ntp 服务器/s)。

我的配置文件有什么错误吗?我缺少任何步骤吗?

4

1 回答 1

0

当您失去与 Internet 的连接并且您没有在 DNS 缓存中解析 NTP 域时,您的站点无法解析 NTP 域名。这是首先要检查的。如果您丢弃所有流量并制作隧道,那么您应该允许这种传输通过防火墙进入您的电台。

于 2014-07-07T08:19:20.960 回答