ntpd 服务器意外关闭

ntpd 服务器意外关闭

我有一个正在运行的 ntpd 服务器,为办公室内的所有电脑提供时间。最近它开始意外关闭。

日志中没有任何内容:

30 Aug 02:25:43 ntpd[1590]: peers refreshed
30 Aug 02:25:43 ntpd[1590]: new interface(s) found: waking up resolver
30 Aug 02:25:45 ntpd[1949]: DNS 0.europe.pool.ntp.org -> 62.237.86.234
30 Aug 02:25:47 ntpd[1949]: DNS 3.gr.pool.ntp.org -> 193.93.167.241
30 Aug 02:25:47 ntpd[1949]: DNS 3.europe.pool.ntp.org -> 149.210.163.34
30 Aug 02:25:52 ntpd[1590]: Listen normally on 10 tun1 192.168.26.18 UDP 123
30 Aug 02:25:52 ntpd[1590]: peers refreshed
30 Aug 02:25:52 ntpd[1590]: new interface(s) found: waking up resolver
 7 Sep 06:16:36 ntpd[25112]: Listen normally on 10 multicast 224.0.1.1 UDP 123
 7 Sep 06:16:36 ntpd[25112]: Joined 224.0.1.1 socket to multicast group 224.0.1.
1

配置是

cat /etc/ntp.conf | egrep -v "^(#|$)"

server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
server 3.gr.pool.ntp.org
server 3.europe.pool.ntp.org
server 0.europe.pool.ntp.org
driftfile /etc/ntp/drift
multicastclient 224.0.1.1               # listen on default 224.0.1.1
broadcastdelay  0.008
restrict default kod nomodify notrap noquery nopeer
restrict pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 192.168.18.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
logfile /var/log/ntp.log

我或许应该注意到,ntp 守护进程监听所有接口(2 个以太网 + 2 个 vpn-tun),但防火墙只允许来自内联网的请求 - 而不是 vpn 或互联网接口。

到底是出了什么问题,然后ntpd就退出了?

答案1

嗯,因此ntpd -g -d从命令行运行,提供答案:

clock_update: at 260 sample 260 associd 48025
event at 260 0.0.0.0 0617 07 panic_stop -10796 s; set clock manually within 1000 s.

日期相差超过 1000 秒,因此 ntpd 将退出。奇怪的是这个重要信息没有打印在日志中。

无论如何,直接运行它(即不通过 rc.init 脚本)并提供详细输出就可以提供答案。

答案2

修改默认的 rc.ntpd 脚本,在启动和重启操作期间调用 ntpdate。这样,即使时钟相差超过 1000 秒,它仍会更新。

我相信 ntpdate 会默认更新硬件时钟 - 它可能需要一个可选开关来执行此操作。

相关内容