「NTP」- 常见错误列表

#1 no server suitable for synchronization found

# ntpdate -v 103.213.249.202
 5 Apr 23:25:30 ntpdate[32496]: ntpdate 4.2.8p10@1.3728-o (1)
 5 Apr 23:25:38 ntpdate[32496]: no server suitable for synchronization found

原因:这个问题的原因可能会有很多种,说以下我遇到的情况:103.213.249.202是我自己的NTP服务,我在服务器中配置了防火墙,导致NTP服务在请求上游的服务器时,数据包被防火墙过滤掉了。解决办法就是添加防火墙规则。

解决iptables -A INPUT -i eth0 -p udp -m udp --dport 123 --sport 123 -j ACCEPT

#2 the NTP socket is in use, exiting

# ntpdate -v 0.centos.pool.ntp.org
 5 Apr 23:35:14 ntpdate[7475]: ntpdate 4.2.6p5@1.2349-o Wed Jul 12 12:22:59 UTC 2017 (1)
 5 Apr 23:35:14 ntpdate[7475]: the NTP socket is in use, exiting

原因:本地已经运行了NTP服务。NTP服务运行使使用了123端口,而ntpdate发送查询数据包时默认的源端口也是123。

系统:Ubuntu 14.04.5 LTS

解决:有两种解决方法:
1)停止本地服务即可。执行service ntp stop命令来停止服务,或者使用其他方法来停止。
2)使用ntpdate的-u选项,在发送数据包时使用非特权端口(>1024)。