我们在几个linux盒子上有一个ntp-client的问题。 首先,我们的networking中有三个ntp服务器。 在我们的大部分盒子上,同步都很好。 从昨天开始,一个操作系统的linux系统在同步时遇到了问题。 这些盒子正在运行Debian 8.7,安装了ntp 4.2.6.p5 + dfsg-7 + deb8u2。
它看起来像这样:
% sudo ntpq -pn remote refid st t when poll reach delay offset jitter ============================================================================== 10.2.1.161 .INIT. 16 u - 64 0 0.000 0.000 0.000 10.2.1.159 .INIT. 16 u - 64 0 0.000 0.000 0.000 10.2.2.233 .INIT. 16 u - 64 0 0.000 0.000 0.000
我知道延迟,偏移和抖动的值是0,因为层数是16,所以ntp客户端拒绝与服务器同步。
我不明白的是,为什么stratum在16岁。我跟防火墙的人聊过,什么都没有丢。 所以我做了一个tcpdump,但我看不到任何可以解释这种行为的东西。
客户端包是这样的:
Network Time Protocol (NTP Version 4, client) Flags: 0xe3, Leap Indicator: unknown (clock unsynchronized), Version number: NTP Version 4, Mode: client Peer Clock Stratum: unspecified or invalid (0) Peer Polling Interval: 6 (64 sec) Peer Clock Precision: 0.000000 sec Root Delay: 0 seconds Root Dispersion: 0 seconds Reference ID: (Initialization) Reference Timestamp: Jan 1, 1970 00:00:00.000000000 UTC Origin Timestamp: Jan 1, 1970 00:00:00.000000000 UTC Receive Timestamp: Jan 1, 1970 00:00:00.000000000 UTC Transmit Timestamp: Jul 26, 2017 08:20:14.664923929 UTC
而服务器包是这样的:
Network Time Protocol (NTP Version 4, server) Flags: 0x24, Leap Indicator: no warning, Version number: NTP Version 4, Mode: server Peer Clock Stratum: secondary reference (3) Peer Polling Interval: 6 (64 sec) Peer Clock Precision: 0.000000 sec Root Delay: 0.0225830078125 seconds Root Dispersion: 0.0608673095703125 seconds Reference ID: 213.239.239.166 Reference Timestamp: Jul 26, 2017 08:05:26.414539267 UTC Origin Timestamp: Jul 26, 2017 08:20:14.664923929 UTC Receive Timestamp: Jul 26, 2017 08:20:14.664904341 UTC Transmit Timestamp: Jul 26, 2017 08:20:14.664934357 UTC
系统日志条目不显示任何错误消息:
Jul 26 10:55:10 servername systemd[1]: Starting LSB: Start NTP daemon... Jul 26 10:55:10 servername ntpd[131489]: ntpd [email protected] Fri Jul 22 17:30:51 UTC 2016 (1) Jul 26 10:55:10 servername ntpd[131490]: proto: precision = 0.101 usec Jul 26 10:55:10 servername ntpd[131490]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123 Jul 26 10:55:10 servername ntp[131479]: Starting NTP server: ntpd. Jul 26 10:55:10 servername systemd[1]: Started LSB: Start NTP daemon. Jul 26 10:55:10 servername ntpd[131490]: Listen and drop on 1 v6wildcard :: UDP 123 Jul 26 10:55:10 servername ntpd[131490]: Listen normally on 2 lo 127.0.0.1 UDP 123 Jul 26 10:55:10 servername ntpd[131490]: Listen normally on 3 bond0 10.2.32.121 UDP 123 Jul 26 10:55:10 servername ntpd[131490]: Listen normally on 4 lo ::1 UDP 123 Jul 26 10:55:10 servername ntpd[131490]: Listen normally on 5 bond0 fe80::1618:77ff:fe33:2309 UDP 123 Jul 26 10:55:10 servername ntpd[131490]: peers refreshed Jul 26 10:55:10 servername ntpd[131490]: Listening on routing socket on fd #22 for interface updates
在命令行上运行ntpdate工作正常:
% ntpdate -u 10.2.1.161 26 Jul 11:00:05 ntpdate[132651]: adjust time server 10.2.1.161 offset 0.001240 sec
所以,也许我没有看到树木的木材。 无论如何,任何帮助真的不胜感激:)
坦克你们!
我find了原因:)
箱子上使用的configuration是由一个不在这里工作的同事做出的。 没有人知道关于ntp的任何事情。 所以我换成使用ntp包发布的configuration文件,只是把服务器改成我们的。 重新启动ntp服务closures课程,时间同步正在工作!
大多数参数都是模拟的,但在我们的自定义configuration中缺less以下参数:
statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable
我没有时间阅读这些参数,所以我不能告诉他们任何事情。 最重要的是,它正在工作:D