我在另一个子网中的一台机器上安装了一台NTP服务器,并试图在服务器上安装我的机器,并且工作正常。 但是,当我尝试使用pool.ntp.org服务器(我尝试了0.pool.ntp.org,1.pool.ntp.org等,只是pool.ntp.org服务器),它不同步。
在pool.ntp.org上的nslookup以及0.pool.ntp.org也提供了正确的DNSparsing,而且ping也在nslookup返回的IP上工作。
iptables grepped for UDP的输出如下:
[Thu Feb 10 12:39:14 root @ root-ubuntu:〜]#iptables -L -n -v | grep udp
92 13001 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:123 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:161 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:443 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:623 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:389 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:636 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:3268 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:3269
netstat命令的输出如下所示:
[Thu Feb 10 12:35:51 root @ root-ubuntu:〜]#netstat -a | grep udp
udp 0 0 localhost:9473 0.0.0.0:* udp 0 0 0.0.0.0:asf-rmcp 0.0.0.0:* udp 0 0 173.39.22.123:ntp 0.0.0.0:* udp 0 0 localhost:ntp 0.0.0.0:* udp 0 0 0.0.0.0:ntp 0.0.0.0:* udp 0 0 all-systems.mcast.net:23000 0.0.0.0:* udp 0 0 ::1:ntp ::%628620:* udp 0 0 fe80::222:bdff:feea:9f1f:ntp ::%628620:* udp 0 0 fe80::222:bdff:feea:9f20:ntp ::%628620:* udp 0 0 :::ntp ::%628620:*
我无法弄清楚为什么同步问题只发生在池服务器而不是本地服务器上。 我系统中的UDP端口已启动。 服务器已经启动。 时间不同步(它仍然显示2月10日)
[编辑]添加我的.conf文件:
driftfile /tmp/ntp.drift/
server 0.pool.ntp.org
添加ntpq -p数据:
[Thu Feb 10 14:13:51 root @ root-ubuntu:〜] #ntpq -p 0.pool.ntp.org
remote refid st t when poll reach delay offset jitter ============================================================================== *64.147.116.229 .ACTS. 1 u 151 1024 377 2.439 -0.632 0.052 +131.107.13.100 .ACTS. 1 u 879 1024 377 27.853 1.041 0.539 -time.nrc.ca 132.246.11.231 2 u 989 1024 377 86.821 -4.132 8.778 -time1.chu.nrc.c 209.87.233.52 2 u 53 1024 377 109.221 3.153 9.377 +dense.utcc.utor 128.100.200.166 2 u 88 1024 377 64.115 -1.841 0.454 -dns4.utoronto.c 128.100.103.253 2 u 167 1024 377 65.252 -43.422 56.093
等一下。 2月 10日? ntp不会同步那么远。 这是几秒钟和几毫秒; 不是几个小时和几天。
您应该首先使用ntpdate大致设置date或精确设置date。
它从NTP服务器获取时间,但不会自动调整系统时间,因为这会导致严重的问题。 因此,您必须手动将date设置为大致的时间,最好在一分钟之内,或者使用另一个程序来同步时间,通过使用增量时间步骤来逐步更新时间。
但是,如果经常过几天或几个月,则应该解决为什么会发生这种情况,而不是期望自动修复。 想象一下,那些时间跳转可能会对你的服务器日志和数据库产生什么样的影响 – 这就是为什么NTP客户端不能同步这么大的差异。
替代scheme我可以想到,哪个明智地调整与服务器的时间是chrony和proxmox 。