台湾地区一台机器进行时间同步时,出现下面的错误。很显然,它提示的是不能找到主机time.stdtime.gov.tw。 所以我初步猜测是由于dns解析的问题
1 2 3 4 | # /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.tw 29 Oct 14:18:59 ntpdate[25327]: no servers can be used, exiting |
确认防火墙没有问题后,执行域名解析,发现失败
1 2 | # nslookup time.stdtime.gov.tw ;; connection timed out; no servers could be reached |
尝试ping外网,以确认能正常连到外网,连网正常
1 2 3 4 5 6 7 | # 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 1000ms rtt min/avg/max/mdev = 1.404/1.445/1.487/0.056 ms |
修改/etc/resolv.conf文件
1 2 3 | # cat /etc/resolv.conf nameserver 172.0.0.29 nameserver 8.8.8.8 |
修改后,再次执行时间同步,ok鸟!
1 2 | # /usr/sbin/ntpdate time.stdtime.gov.tw 29 Oct 14:23:36 ntpdate[25337]: adjust time server 59.124.196.84 offset 0.100921 sec |