Ntpd

ntpdate 成功獲取偏移量後報告失敗

  • November 12, 2015

ntpdate -d``no server suitable即使它成功連接到伺服器並列印了偏移量,有時也會列印錯誤。為什麼?

在我的腳本中需要區分網路錯誤和這個。如何強制它以零狀態退出?

好的:

# ntpdate -d 10.3.2.67
12 Nov 13:23:21 ntpdate[6565]: ntpdate 4.2.6p5@1.2349-o Mon Jul 15 09:22:50 UTC 2013 (1)
Looking for host 10.3.2.67 and service ntp
host found : ec-prod-app-1
transmit(10.3.2.67)
receive(10.3.2.67)
transmit(10.3.2.67)
receive(10.3.2.67)
transmit(10.3.2.67)
receive(10.3.2.67)
transmit(10.3.2.67)
receive(10.3.2.67)
server 10.3.2.67, port 123
stratum 4, precision -21, leap 00, trust 000
refid [10.3.2.67], delay 0.02574, dispersion 0.00000
transmitted 4, in filter 4
reference time:    d9eee40d.738ce7c1  Thu, Nov 12 2015 13:10:21.451
originate timestamp: d9eee719.a97c80cf  Thu, Nov 12 2015 13:23:21.662
transmit timestamp:  d9eee719.a9245fa8  Thu, Nov 12 2015 13:23:21.660
filter delay:  0.02579  0.02586  0.02574  0.02574
        0.00000  0.00000  0.00000  0.00000
filter offset: 0.001251 0.001187 0.001244 0.001243
        0.000000 0.000000 0.000000 0.000000
delay 0.02574, dispersion 0.00000
offset 0.001244

12 Nov 13:23:21 ntpdate[6565]: adjust time server 10.3.2.67 offset 0.001244 sec

壞的:

# ntpdate -d 10.3.2.68
12 Nov 13:23:24 ntpdate[6566]: ntpdate 4.2.6p5@1.2349-o Mon Jul 15 09:22:50 UTC 2013 (1)
Looking for host 10.3.2.68 and service ntp
host found : ec-prod-app-2
transmit(10.3.2.68)
receive(10.3.2.68)
transmit(10.3.2.68)
receive(10.3.2.68)
transmit(10.3.2.68)
receive(10.3.2.68)
transmit(10.3.2.68)
receive(10.3.2.68)
10.3.2.68: Server dropped: strata too high
server 10.3.2.68, port 123
stratum 16, precision -20, leap 11, trust 000
refid [10.3.2.68], delay 0.02574, dispersion 0.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Mon, Jan  1 1900  3:00:00.000
originate timestamp: d9eee71b.a14c710c  Thu, Nov 12 2015 13:23:23.630
transmit timestamp:  d9eee71c.5e083201  Thu, Nov 12 2015 13:23:24.367
filter delay:  0.02577  0.02574  0.02574  0.02577
        0.00000  0.00000  0.00000  0.00000
filter offset: -0.73732 -0.73732 -0.73733 -0.73734
        0.000000 0.000000 0.000000 0.000000
delay 0.02574, dispersion 0.00000
offset -0.737324

12 Nov 13:23:24 ntpdate[6566]: no server suitable for synchronization found

您是否注意到:

10.3.2.68: Server dropped: strata too high

並且:

stratum 16, precision -20, leap 11, trust 000

輸出中的行?

客戶端認為ntp時間源不夠健全(即沒有與較低層伺服器同步)

引用自:https://unix.stackexchange.com/questions/242529