一、問題報錯:
忽然發現某台機器時間慢了些幾分鍾,之前沒有搭建ntpd服務,目前都是使用的ntpdate加定時任務進行時間同步。直接執行ntpdate報錯如下:
# ntpdate cn.pool.ntp.org Exiting, name server cannot be used: Temporary failure in name resolution (-3) 3 Sep 15:46:46 ntpdate[13742]: name server cannot be used: Temporary failure in name resolution (-3)
二、問題原因:
一般報錯為Temporary failure in name resolution為無法解析,經測試ping也不通。所以判斷為resolv.conf文件問題
# ping www.baidu.com ping: unknown host www.baidu.com
三、解決方法:
可根據網絡供應商填寫正確的DNS地址
# cat /etc/resolv.conf nameserver 114.114.114.114 nameserver 8.8.8.8 # ntpdate cn.pool.ntp.org 3 Sep 17:54:33 ntpdate[17314]: step time server 5.103.139.163 offset 995.587830 sec