Linux

更新到 CentOS 6.5 後 NTP 停止工作

  • March 20, 2018

幾天前,我在網路上設置了 ntp,一切執行良好。一個節點被設置為與上游伺服器同步,並且一組中的其餘節點與上游同步。

昨天我從 CentOS 6.4 -> 6.5 更新,現在所有的 ntp 功能都已停止按預期執行。

為了嘗試調試這種情況,我在上游伺服器上執行了以下命令:

$ -> ntpq -pnd
::1: timed out, nothing received
***Request timed out

$ -> ntpq -4 -pnd
1 packets reassembled into response
remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
2 packets reassembled into response
*50.116.55.65    64.246.132.14    2 u   42   64   37   77.742  189.392  14.812
2 packets reassembled into response
199.102.46.73   .GPS.            1 u   44   64   37   73.786  216.082  18.406
2 packets reassembled into response
198.60.22.240   .GPS.            1 u   48   64   37   22.617  189.405  15.996
2 packets reassembled into response
127.127.1.0     .LOCL.          10 l  306   64   20    0.000    0.000   0.000

我在節點上得到相同的結果(除了 diff ip)。似乎,不知何故,ntp 服務預設為 ipv6,我沒有配置。我讀過一些網站說將 -4 傳遞給 ntpd 服務,但我將如何使用 chkconfig 來做到這一點?其他一些讀數表明我應該通過核心禁用 ipv6,但這似乎有點矯枉過正。

有什麼建議麼?

為了完整起見,添加配置文件:

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1

restrict 10.0.0.0 mask 255.255.192.0 nomodify notrap


server 0.centos.pool.ntp.org iburst

server 1.centos.pool.ntp.org

server 2.centos.pool.ntp.org


# In case net access is temporarily down
server 127.127.1.0
fudge 127.127.1.0 stratum 10

由於它正在嘗試使用 IPv6,您可能希望在配置文件中允許它:

restrict -6 ::1

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