NTP 服务器无法正常工作

lud*_*egu 4 rhel ntpd

我在我拥有的 Red Hat 服务器上安装了一个非常简单的 NTP 服务器,配置非常基本:

driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap 
restrict -6 default kod nomodify notrap 
restrict 127.0.0.1 
restrict -6 ::1
restrict 192.168.200.0 mask 255.255.255.0 nomodify notrap
server 0.rhel.pool.ntp.org
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
Run Code Online (Sandbox Code Playgroud)

如果我尝试从本地主机测试它,它似乎可以正常工作:

ntpq -p localhost
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 gw-ge.esaote.co 62.48.53.90      3 u   56   64  173   81.474  -163823 67736.2
Run Code Online (Sandbox Code Playgroud)

如果我尝试从远程机器查询它,结果相同:

ntpq -p 192.168.200.151
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 gw-ge.esaote.co 62.48.53.90      3 u    -   64  367   75.500  -163838 61828.5
Run Code Online (Sandbox Code Playgroud)

但是,如果我调用ntpdate,则不起作用:

ntpdate 192.168.200.151
12 Mar 10:35:51 ntpdate[2688]: no server suitable for synchronization found
Run Code Online (Sandbox Code Playgroud)

Flu*_*lup 5

您的 NTP 服务器与池服务器不同步太远。您会注意到ntpq -p输出中主机名前最左边的字符是一个空格。如果 NTP 同步到远程服务器,这将是一个*. 还要注意非常大的offset值,它告诉您服务器上设置的时间已经过时。

停止NTP,执行a ntpdate pool.ntp.org,然后重新启动它。几分钟后,它应该会稳定下来并同步,然后您的客户端应该能够查询它。