我在另一个子网中的机器上设置了一个NTP服务器,并尝试将我的机器与服务器同步,它运行良好。但是,当我尝试强制使用pool.ntp.org服务器(我尝试了0.pool.ntp.org、1.pool.ntp.org等,而只是pool.ntp.org服务器)时,它并不同步。
pool.ntp.org上的nslookup以及0.pool.ntp.org给出了适当的DNS解析,并且ping工作于IP返回需要的nslookup。
为UDP提供的iptables的输出如下:
清华2月10日12:39:14根@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命令的输出如下:
清华2月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数据:
清华2月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发布于 2012-12-11 09:58:44
哦,等等。二月十号?不是的。ntp不会同步那么远。它是秒和毫秒,而不是小时和天。
您应该使用date粗略地设置日期,或者首先使用ntpdate准确地设置日期。
发布于 2012-12-11 10:08:28
它正在从NTP服务器获得时间,但是它不会如此大幅度地自动调整系统时间,因为这可能会导致严重的问题。因此,您必须手动将日期设置为大约的时间,最好是在一分钟内,或者使用替代程序同步时间,通过使用增量时间步骤逐步更新时间。
但是,如果您经常已经过时了几天或几个月,那么您应该解决发生这种情况的原因,而不是期望它会自动修复。例如,想象一下这种时间跳转会对服务器日志和数据库造成什么影响--这就是为什么NTP客户端不会因为如此巨大的差异而同步。
我能想到的替代方案是chrony和proxmox,它们可以明智地调整与服务器的时间。
https://serverfault.com/questions/456973
复制相似问题