解决ntp的错误:no server can be used,exiting
时间:2013-10-29 07:10:20 作者:vaster 标签: Linux ntp错误 分类: Linux Linux服务
台湾地区一台机器进行时间同步时,出现下面的错误。很显然,它提示的是不能找到主机time.stdtime.gov.tw。 所以我初步猜测是由于dns解析的问题
# /usr/sbin/ntpdate time.stdtime.gov.tw Error : Temporary failure in name resolution 29 Oct 14:18:59 ntpdate[25327]: can't find host time.stdtime.gov.tw29 Oct 14:18:59 ntpdate[25327]: no servers can be used, exiting 29 Oct 14:18:59 ntpdate[25327]: no servers can be used, exiting
确认防火墙没有问题后,执行域名解析,发现失败
# nslookup time.stdtime.gov.tw;; connection timed out; no servers could be reached ;; connection timed out; no servers could be reached
尝试ping外网,以确认能正常连到外网,连网正常
# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=53 time=1.48 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=53 time=1.40 ms --- 8.8.8.8 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000msrtt min/avg/max/mdev = 1.404/1.445/1.487/0.056 ms rtt min/avg/max/mdev = 1.404/1.445/1.487/0.056 ms
修改/etc/resolv.conf文件
# cat /etc/resolv.conf nameserver 172.0.0.29nameserver 8.8.8.8 nameserver 8.8.8.8
修改后,再次执行时间同步,ok鸟!
# /usr/sbin/ntpdate time.stdtime.gov.tw29 Oct 14:23:36 ntpdate[25337]: adjust time server 59.124.196.84 offset 0.100921 sec 29 Oct 14:23:36 ntpdate[25337]: adjust time server 59.124.196.84 offset 0.100921 sec