微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ubuntu – 为什么ntpd没有更新我服务器上的时间?

我的服务器上运行了ntpd.这是所有认设置,除了我注释了它作为服务器到其他机器的能力:
# restrict -4 default kod notrap nomodify nopeer noquery                                                                    
# restrict -6 default kod notrap nomodify nopeer noquery   
restrict default ignore

如果我运行ntpdate -q ntp.ubuntu.com,我被告知我的机器时钟已关闭7秒.

这是怎么回事?如何诊断发生了什么,是否有我可以打开的日志?

更多信息#1

# ntpq -np
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 91.189.94.4     193.79.237.14    2 u   30   64    7  108.518   -0.136   0.361

更多信息#2

这是我问这个问题时的样子:

# ntpdate -q ntp.ubuntu.com
server 91.189.94.4,stratum 2,offset 7.191308,delay 0.13310
10 Jan 20:38:09 ntpdate[31055]: step time server 91.189.94.4 offset 7.191308 sec

在重新启动ntpd几次之后,这就是现在的样子(我假设这是修复它的原因):

# ntpdate -q ntp.ubuntu.com
server 91.189.94.4,offset 0.000112,delay 0.13164
10 Jan 20:47:03 ntpdate[31419]: adjust time server 91.189.94.4 offset 0.000112 sec

更多信息#3

我卸载了ntp并安装了openntpd并运行了/usr/sbin / ntpd -d,我看到这样的输出

reply from 64.73.32.134: offset 6.715003 delay 0.041152,next query 30s
reply from 208.53.158.34: offset 6.700224 delay 0.036263,next query 31s
adjusting local clock by 6.734120s
reply from 72.18.205.156: offset 6.708575 delay 0.035885,next query 30s
reply from 64.73.32.134: offset 6.701463 delay 0.044199,next query 33s

对我来说非常清楚地表明我无法在我的服务器上设置时间(尽管使用常规的ntp,它似乎有时会更新……).

更多信息#4

我的VPS提供商说:

The latest kernels should not lock
your system to our dom0’s clock,to be
on the safe side you can set
xen.independent_wallclock = 1 in your
sysctl.conf.

我认为仍然没有解决VPS需要cpu可用的问题,以便进行正确的时序计算.

您可以通过将其添加到ntp.conf来启用ntpd中的日志记录:
logfile /var/log/ntpd.log

资料来源:ntp manual

如果关闭ntpd,可以通过命令行更新时钟吗?如果您运行ntpdate命令并收到如下错误

# ntpdate ntp.ubuntu.com
10 Jan 23:47:57 ntpdate[26284]: Can't adjust the time of day: Operation not permitted

这意味着您可能正在使用VPS,在这种情况下,您无法修改系统时钟 – 这只能在主机上完成.

原文地址:https://www.jb51.cc/ubuntu/348951.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐