操作系统:Centos 6.4
备注:Centos 6.4的ntpdate 在/usr/sbin/ntpdate,而Centos 5.X的ntpdate在/sbin/ntpdate,如果不确定可以尝试find一下。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
0 1 2 3 4 |
[root@byrd ~]# find / -name "ntpdate" /usr/sbin/ntpdate /etc/rc.d/init.d/ntpdate /etc/sysconfig/ntpdate [root@byrd ~]# |
0 1 2 3 4 5 |
[byrd@nginx ~]$ /usr/sbin/ntpdate 210.72.145.44 26 Mar 13:29:55 ntpdate[31944]: bind() fails: Permission denied [root@nginx ~]# /usr/sbin/ntpdate 210.72.145.44 26 Mar 13:30:21 ntpdate[31963]: no server suitable for synchronization found [root@nginx ~]# /usr/sbin/ntpdate time.windows.com 26 Mar 13:31:05 ntpdate[31964]: no server suitable for synchronization found |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@nginx ~]# ntpdate -d time.windows.com 26 Mar 13:33:59 ntpdate[31968]: ntpdate 4.2.6p5@1.2349-o Sat Nov 23 18:20:12 UTC 2013 (1) Looking for host time.windows.com and service ntp host found : 65.55.56.206 transmit(65.55.56.206) transmit(65.55.56.206) transmit(65.55.56.206) transmit(65.55.56.206) transmit(65.55.56.206) 65.55.56.206: Server dropped: no data server 65.55.56.206, port 123 stratum 0, precision 0, leap 00, trust 000 refid [65.55.56.206], delay 0.00000, dispersion 64.00000 transmitted 4, in filter 4 reference time: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000 originate timestamp: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000 transmit timestamp: d6dce54b.365b28c1 Wed, Mar 26 2014 13:34:03.212 filter delay: 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 filter offset: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 delay 0.00000, dispersion 64.00000 offset 0.000000 26 Mar 13:34:04 ntpdate[31968]: no server suitable for synchronization found |
0 |
[root@nginx ~]# service iptables stop |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[root@nginx ~]# ntpdate -d time.windows.com 26 Mar 13:53:38 ntpdate[32382]: ntpdate 4.2.6p5@1.2349-o Sat Nov 23 18:20:12 UTC 2013 (1) Looking for host time.windows.com and service ntp host found : 64.4.10.33 transmit(64.4.10.33) receive(64.4.10.33) transmit(64.4.10.33) receive(64.4.10.33) transmit(64.4.10.33) receive(64.4.10.33) transmit(64.4.10.33) transmit(64.4.10.33) server 64.4.10.33, port 123 stratum 2, precision -6, leap 00, trust 000 refid [64.4.10.33], delay 0.24284, dispersion 8.01073 transmitted 4, in filter 4 reference time: d6dce8c8.aa822c95 Wed, Mar 26 2014 13:48:56.666 originate timestamp: d6dce9e3.62928ee3 Wed, Mar 26 2014 13:53:39.385 transmit timestamp: d6dce9e3.7b92f8de Wed, Mar 26 2014 13:53:39.482 filter delay: 0.24370 0.24359 0.24284 0.00000 0.00000 0.00000 0.00000 0.00000 filter offset: 0.017055 0.017701 0.003164 0.000000 0.000000 0.000000 0.000000 0.000000 delay 0.24284, dispersion 8.01073 offset 0.003164 26 Mar 13:53:40 ntpdate[32382]: adjust time server 64.4.10.33 offset 0.003164 sec |
原因:
①:开启防火墙后可以收到回应包,证明是防火墙的原因,生产环境中,开启udp123端口即可;SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
②:可能的因素是在/etc/ntp.conf中禁止了相关notrust参数。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
1。检查ntp的版本,如果你使用的是ntp4.2(包括4.2)之后的版本,在restrict的定义中使用了notrust的话,会导致以上错误。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
使用以下命令检查ntp的版本:
0 |
# ntpq -c version |
下面是来自ntp官方网站的说明:
The behavior of notrust changed between versions 4.1 and 4.2.SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
In 4.1 (and earlier) notrust meant "Don't trust this host/subnet for time".SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
In 4.2 (and later) notrust means "Ignore all NTP packets that are not cryptographically authenticated." This forces remote time servers to authenticate themselves to your (client) ntpdSourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
解决:SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
把notrust去掉。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
补充内容(非原创):
当用ntpdate -d 来查询时会发现导致 no server suitable for synchronization found 的错误的信息有以下2个: SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
错误1.Server dropped: Strata too highSourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
在ntp客户端运行ntpdate serverIP,出现no server suitable for synchronization found的错误。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
在ntp客户端用ntpdate –d serverIP查看,发现有“Server dropped: strata too high”的错误,并且显示“stratum 16”。而正常情况下stratum这个值得范围是“0~15”。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
这是因为NTP server还没有和其自身或者它的server同步上。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
以下的定义是让NTP Server和其自身保持同步,如果在/ntp.conf中定义的server都不可用时,将使用local时间作为ntp服务提供给ntp客户端。
0 1 |
server 127.127.1.0 fudge 127.127.1.0 stratum 8 |
在ntp server上重新启动ntp服务后,ntp server自身或者与其server的同步的需要一个时间段,这个过程可能是5分钟,在这个时间之内在客户端运行ntpdate命令时会产生no server suitable for synchronization found的错误。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
那么如何知道何时ntp server完成了和自身同步的过程呢?SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
在ntp server上使用命令:
0 |
# watch ntpq -p |
出现画面:
0 1 2 3 4 5 6 7 8 |
Every 2.0s: ntpq -p Thu Jul 10 02:28:32 2008 remote refid st t when poll reach delay offset jitter ============================================================================== 192.168.30.22 LOCAL(0) 8 u 22 64 1 2.113 179133. 0.001 LOCAL(0) LOCAL(0) 10 l 21 64 1 0.000 0.000 0.001 |
注意LOCAL的这个就是与自身同步的ntp server。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
注意reach这个值,在启动ntp server服务后,这个值就从0开始不断增加,当增加到17的时候,从0到17是5次的变更,每一次是poll的值的秒数,是64秒*5=320秒的时间。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
如果之后从ntp客户端同步ntp server还失败的话,用ntpdate –d来查询详细错误信息,再做判断。SourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
申明:本文由BYRD原创(基于Centos6.4 X64),未经许可禁止转载!
参考地址:http://www.blogjava.net/spray/archive/2008/07/10/213964.html
参考地址:http://blog.sina.com.cn/s/blog_3f1a25310100qn84.html
参考地址:http://wiki.ubuntu.org.cn/NTPSourceByrd's Weblog-https://note.t4x.org/error/ntp-no-server-suitable-synchronization-found/
Trackbacks