我正在尝试为我们的局域网设置本地NTP服务器。 我可以运行ntpdate server_ip手动更新时间。 但是,ntp守护进程似乎没有logging任何东西到系统日志,所以我不知道是否有任何系统同步。
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help driftfile /var/lib/ntp/ntp.drift 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 logconfig =syncall +clockall # Specify one or more NTP servers. # Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for # more information. server 10.0.1.201 iburst minpoll 3 maxpoll 4 restrict -4 default kod notrap nomodify nopeer restrict -6 default kod notrap nomodify nopeer # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for # details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions> # might also be helpful. # # Note that "restrict" applies to both servers and clients, so a configuration # that might be intended to block requests from certain clients could also end # up blocking replies from your own upstream servers. # Local users may interrogate the ntp server more closely. #restrict 127.0.0.1 #restrict ::1 # Clients from this (example!) subnet have unlimited access, but only if # cryptographically authenticated. #restrict 192.168.123.0 mask 255.255.255.0 notrust # If you want to provide time to your local subnet, change the next line. # (Again, the address is an example only.) #broadcast 192.168.123.255 # If you want to listen to time broadcasts on your local subnet, de-comment the # next lines. Please do this only if you trust everybody on the network! disable auth #broadcastclient
我可能会错过什么?
系统日志中的NTP通常非常安静/无声。 如果它出现了,事情就会出错。 如果您的硬件时钟正在工作,则在启动过程中不需要修改时钟。 如果需要,使用正确的设置可以取代ntpdate以在启动时设置时钟。
您要查看的日志是loopstats和peerstats文件。 一旦运行NTP就不需要同步时钟。 它会非常轻微地调整滴答定时,以保持时钟同步。 loopstats文件提供您的本地状态,而peerstats显示您的状态相对于您正在使用的服务器。 有关这些文件的详细信息,请参阅NTP故障排除指南 。