Ntp

NTP 無法同步或找不到合適的伺服器

  • January 21, 2014

我要解決的問題是 NTP 不會同步:

$ sudo ntpstat
unsynchronised
 time server re-starting
  polling server every 64 s

編輯:這是一些 ntpq 輸出:

$ sudo ntpq -c peers
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
ntp.eecs.wsu.ed .INIT.          16 u    -   64    0    0.000    0.000   0.000
71.19.224.242   .INIT.          16 u    -   64    0    0.000    0.000   0.000
ntp4.vps.net    .INIT.          16 u    -   64    0    0.000    0.000   0.000
mercury.z0p.org .INIT.          16 u    -   64    0    0.000    0.000   0.000
li506-17.member .INIT.          16 u    -   64    0    0.000    0.000   0.000
4.53.160.75     .INIT.          16 u    -   64    0    0.000    0.000   0.000
ntp1.ResComp.Be .INIT.          16 u    -   64    0    0.000    0.000   0.000

我有預設的 RHEL6 /etc/ntp.conf 配置。伺服器位:

server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org

當我停止 ntpd 並嘗試手動執行 ntpdate 時,我得到所有這些伺服器的“找不到適契約步的伺服器”。這是帶有調試輸出的 ntpdate:

$ ntpdate -dq 1.rhel.pool.ntp.org
10 May 10:02:42 ntpdate[13320]: ntpdate 4.2.4p8@1.1612-o Thu May 13 14:38:25 UTC 2010 (1)
Looking for host 1.rhel.pool.ntp.org and service ntp
host found : caprica.willglynn.com
transmit(208.88.126.226)
transmit(66.225.61.66)
transmit(149.20.68.17)
transmit(4.53.160.75)
transmit(208.88.126.226)
transmit(66.225.61.66)
transmit(149.20.68.17)
transmit(4.53.160.75)
transmit(208.88.126.226)
transmit(66.225.61.66)
transmit(149.20.68.17)
transmit(4.53.160.75)
transmit(208.88.126.226)
transmit(66.225.61.66)
transmit(149.20.68.17)
transmit(4.53.160.75)
transmit(208.88.126.226)
transmit(66.225.61.66)
transmit(149.20.68.17)
transmit(4.53.160.75)
208.88.126.226: Server dropped: no data
66.225.61.66: Server dropped: no data
149.20.68.17: Server dropped: no data
4.53.160.75: Server dropped: no data
server 208.88.126.226, port 123
stratum 0, precision 0, leap 00, trust 000
refid [208.88.126.226], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036  1:28:16.000
originate timestamp: 00000000.00000000  Thu, Feb  7 2036  1:28:16.000
transmit timestamp:  d5377c86.25dd5f5a  Fri, May 10 2013 10:02:46.147
filter delay:  0.00000  0.00000  0.00000  0.00000
        0.00000  0.00000  0.00000  0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
        0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000

server 66.225.61.66, port 123
stratum 0, precision 0, leap 00, trust 000
refid [66.225.61.66], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036  1:28:16.000
originate timestamp: 00000000.00000000  Thu, Feb  7 2036  1:28:16.000
transmit timestamp:  d5377c86.591061f7  Fri, May 10 2013 10:02:46.347
filter delay:  0.00000  0.00000  0.00000  0.00000
        0.00000  0.00000  0.00000  0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
        0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000

server 149.20.68.17, port 123
stratum 0, precision 0, leap 00, trust 000
refid [149.20.68.17], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036  1:28:16.000
originate timestamp: 00000000.00000000  Thu, Feb  7 2036  1:28:16.000
transmit timestamp:  d5377c86.8c427d35  Fri, May 10 2013 10:02:46.547
filter delay:  0.00000  0.00000  0.00000  0.00000
        0.00000  0.00000  0.00000  0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
        0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000

server 4.53.160.75, port 123
stratum 0, precision 0, leap 00, trust 000
refid [4.53.160.75], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036  1:28:16.000
originate timestamp: 00000000.00000000  Thu, Feb  7 2036  1:28:16.000
transmit timestamp:  d5377c86.bf762a87  Fri, May 10 2013 10:02:46.747
filter delay:  0.00000  0.00000  0.00000  0.00000
        0.00000  0.00000  0.00000  0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
        0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000

10 May 10:02:47 ntpdate[13320]: no server suitable for synchronization found

我可以 ping 池將我定向到的一些 NTP 伺服器:

$ ping caprica.willglynn.com
PING caprica.willglynn.com (208.88.126.226) 56(84) bytes of data.
64 bytes from caprica.willglynn.com (208.88.126.226): icmp_seq=1 ttl=52 time=60.2 ms
64 bytes from caprica.willglynn.com (208.88.126.226): icmp_seq=2 ttl=52 time=59.6 ms
64 bytes from caprica.willglynn.com (208.88.126.226): icmp_seq=3 ttl=52 time=59.9 ms
64 bytes from caprica.willglynn.com (208.88.126.226): icmp_seq=4 ttl=52 time=59.8 ms

埠 123 的網路統計:

$ netstat -ano|grep 123
udp        0      0 10.0.116.6:123              0.0.0.0:*                               off (0.00/0/0)
udp        0      0 127.0.0.1:123               0.0.0.0:*                               off (0.00/0/0)
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               off (0.00/0/0)
udp        0      0 :::123                      :::*                                    off (0.00/0/0)

iptables 和 ip6tables 已關閉,但有一個外部防火牆應該為 UDP 打開埠 123。

確保機器和網際網路的其餘部分之間沒有外部防火牆。如果有,請要求管理防火牆的人員打開埠 123。

引用自:https://serverfault.com/questions/506709