无法访问NTPD服务器,除了环回地址Centos 6以外

我只能得到以下结果:

ntpq -p localhost or ntpq -p 127.0.0.1 

如果从同一台服务器,我尝试作为外部IP地址或域名,然后超时没有响应。

 ntpq -p files.tickzoom.com or ntpq -p 50.57.65.92 

那些都从同一台机器出来。

我禁用iptables 。 所以iptables -L显示:

 Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination 

目标实际上是从其他机器访问ntpd。 但即使防火墙closures,他们也无法访问该IP或DNS。

起初,我在禁用iptables之前一直在使用iptables规则,并意识到即使防火墙closures,我也无法做到这一点。

请告诉我发生了什么事情。

看起来您需要修改ntpconfiguration/etc/ntp.conf文件以允许除了环回之外的其他服务器接口请求。 要修改的条目是restrict行中的noquery字段。 noquery字段可防止每个人查询您的时间服务器的状态。

对于IPv4,

 restrict -4 default kod notrap nomodify nopeer noquery 

改成

 restrict -4 default kod notrap nomodify nopeer query 

然后重新启动ntp服务。 您可能需要更多地阅读限制中的modifypeerquery字段以获得更好的设置。

同时,确保ntp使用netstat监听所有接口,使用udp的-u开关

netstat -anu | grep 123

 udp 0 0 0.0.0.0:123 0.0.0.0:* 19339/ntpd