且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ntp版本导致时间同步不成功问题

更新时间:2022-09-11 22:09:32

A:10.240.210.233 

B:10.240.180.171

C:10.240.210.60

A机器(ntp服务器端)

1
2
root@samba ~$ntpq -c version
ntpq 4.2.6p5@1.2349-o Fri Jul 24 10:56:21 UTC 2015 (1)

B机器(客户端,centos5.5)  同步失败

1
2
3
4
root@extmail ~$ntpq -c version
ntpq 4.2.2p1@1.1570-o Sat Dec 20 02:52:15 UTC 2014 (1)
root@extmail ~$ntpdate 10.240.210.233
21 Aug 15:27:05 ntpdate[20107]: no server suitable for synchronization found

C机器(客户端,centos6.6) 执行成功

1
2
3
4
root@oldboy ~$ntpq -c version
ntpq 4.2.6p5@1.2349-o Mon Mar 16 14:53:07 UTC 2015 (1)
root@oldboy ~$ntpdate 10.240.210.233
21 Aug 15:21:50 ntpdate[10574]: adjust time server 10.240.210.233 offset -0.008637 sec

总结,B机器同步失败可能是ntp版本较低,可尝试将其版本升级,或降低服务器(A机器)的NTP版本。


【附】

ntp配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@samba ~$egrep -v "#|^\s*$" /etc/ntp.conf
指定NTP服务器日志文件
logfile /var/log/ntp
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict -6 ::1
restrict 10.240.210.0 mask 255.255.255.0 nomodify notrap
server tiger.sina.com.cn prefer
server 202.112.10.36
restrict 202.112.10.36 nomodify notrap noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys




本文转自 xoyabc 51CTO博客,原文链接:http://blog.51cto.com/xoyabc/1686868,如需转载请自行联系原作者