我有一个问题,在DNS无效的情况下,ntpdate正好在80秒后超时(或者在本例中,主机被卡在防火墙后面)。我想把这个时间降到一些更合理的事情上,比如1到2秒。
# ntpdate -bud ntp.ubuntu.com
23 Sep 08:39:56 ntpdate[9554]: ntpdate 4.2.4p8@1.1612-o Tue Apr 19 07:08:19 UTC 2011 (1)
Looking for host ntp.ubuntu.com and service ntp
Error : Name or service not known 23 Sep 08:41:16 ntpdate[9554]: can't find host ntp.ubuntu.com
23 Sep 08:41:16 ntpdate[9554]: no servers can be used, exiting请注意,-t选项在这里似乎没有帮助,因为它似乎只在服务器可访问时才会启动,加上默认值是1秒。
lsb_release:10.04.4 LTS
uname:2.6.32-43-server #97-Ubuntu SMP Wed Sep 5 16:56:41 UTC 2012 x86_64 GNU/Linux
如果正确配置了DNS,使用无效的NTP服务器将立即超时:
# ntpdate -bud ntp.ubuntu.comm
23 Sep 09:47:39 ntpdate[6523]: ntpdate 4.2.6p5@1.2349-o Mon Apr 13 13:39:47 UTC 2015 (1)
Looking for host ntp.ubuntu.comm and service ntp
Error resolving ntp.ubuntu.comm: Name or service not known (-2)
23 Sep 09:47:39 ntpdate[6523]: Can't find host ntp.ubuntu.comm: Name or service not known (-2)
23 Sep 09:47:39 ntpdate[6523]: no servers can be used, exiting所以我真的认为这更像是DNS解决问题,而不是ntpdate,但是请帮助我找到一个解决方案。
发布于 2015-09-24 14:01:14
我不知道如何修复ntpdate,但您可以首先使用以下命令测试dns查找
nslookup -timeout=1 ntp.ubuntu.com. 它在超时或无法解决时退出1。
https://askubuntu.com/questions/677495
复制相似问题