我正在尝试为我们的局域网设置一个本地NTP服务器。我可以运行ntpdate server_ip手动更新时间。但是,ntp守护进程似乎没有登录到syslog中,因此我无法判断是否有任何系统同步。
# /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我可能错过了什么?
发布于 2013-09-26 14:05:40
在syslog中,NTP通常是非常安静/安静的。如果它出现的话,事情就会变糟。如果您的硬件时钟工作,它不应该需要修改您的时钟在启动。有了正确的设置,它可以替换ntpdate,以便在需要时在启动时设置时钟。
要查看的日志是loopstats和peerstats文件。一旦运行,NTP就不需要同步时钟了。它将调整滴答时间非常轻微,以保持时钟同步。loopstats文件提供本地状态,而peerstats则显示相对于正在使用的服务器的状态。有关这些文件的详细信息,请参阅NTP故障排除指南。
发布于 2019-12-10 22:44:35
为了确认系统是同步的,可以执行以下操作:
# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
159.69.144.253 94.16.116.137 3 u 60 64 37 2.749 -2.464 0.066
*176.9.241.107 192.53.103.108 2 u 61 64 37 0.461 0.237 0.026
193.175.73.20 .MRS. 1 u 62 64 37 19.189 1.786 0.072
138.68.126.106 130.149.17.8 2 u 59 64 37 5.366 0.562 0.043其中,记录的*后缀指示该对等点当前用于同步。
另一方面,对于时钟同步事件的详细监视/日志记录,我发现以下内容非常有用:
首先,如果不存在,创建以下文件夹,并将其所有权分配给运行NTP守护进程的用户:
# mkdir /var/NTP/
# chown ntp /var/NTP/现在,像这样修改ntp.conf,其中每个条目的含义在http://doc.ntp.org/4.2.6p3/monopt.html中都有解释:
statsdir /var/NTP/
filegen clockstats file clockstats
filegen cryptostats file cryptostats
filegen loopstats file loopstats
filegen peerstats file peerstats
filegen protostats file protostats
filegen rawstats file rawstats
filegen sysstats file sysstat
filegen timingstats file timingstats然后重新启动NTP服务并查看/var/NTP/文件夹。
最后,例如,要确定随着时间推移用于同步的对等点,请查找以sys_peer结尾的以/var/NTP/protostats结尾的行,例如:
58827 80454.306 159.69.144.253 8014 84 reachable
58827 80647.304 176.9.241.107 901a 8a sys_peer
58827 80647.304 0.0.0.0 c615 05 clock_sync
58827 80842.323 193.175.73.20 901a 8a sys_peerPS:
发布于 2022-05-21 17:30:14
对不起,伙计们,我有个问题。如果syslog配置为在不使用NTP的情况下发送会计信息,会有什么问题?
https://serverfault.com/questions/541841
复制相似问题