【发布时间】:2019-01-17 10:50:05
【问题描述】:
我正在使用 lubuntu Linux 18.04 Bionic。当我打印 ntpq -pn 时,我看不到我的计算机与我想要的 NTP 服务器同步。
我已经尝试了几个类似这里的教程:LINK。我从 Google HERE 获取了 NTP 服务器,并将所有 4 个服务器都包含到了我的配置文件中。
然后,为了与其中一台 Google NTP 服务器同步,我做了以下事情:
sudo service stop-
sudo service ntpdate time1.google.com并收到了日志ntpdate[2671]: adjust time server 216.239.35.0 offset -0.000330 sec sudo service start
这是我的/etc/ntp.conf 文件:
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery
server time1.google.com iburst
server time2.google.com iburst
server time3.google.com iburst
server time4.google.com iburst
完成上述步骤后,我从ntpq -pn得到了这个结果:
remote refid st t when poll reach delay offset jitter
+216.239.35.0 .GOOG. 1 u 33 64 1 36.992 0.519 0.550
+216.239.35.4 .GOOG. 1 u 32 64 1 20.692 0.688 0.612
*216.239.35.8 .GOOG. 1 u 36 64 1 22.233 0.088 1.091
-216.239.35.12 .GOOG. 1 u 32 64 1 33.480 -0.218 1.378
为什么我的电脑没有同步?
编辑:
这是sudo systemctl status ntp.service之后我的日志输出:
ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-01-17 11:37:33 CET; 17min ago
Docs: man:ntpd(8)
Process: 2704 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=0/SUCCESS)
Main PID: 2712 (ntpd)
CGroup: /system.slice/ntp.service
└─2712 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 105:108
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: proto: precision = 1.750 usec (-19)
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): good hash
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): loaded, e
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listen and drop on 0 v6wildcard [::]:123
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listen and drop on 1 v4wildcard 0.0.0.0:123
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listen normally on 2 lo 127.0.0.1:123
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listen normally on 3 wlan0 192.168.86.26:123
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listen normally on 4 lo [::1]:123
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listen normally on 5 wlan0 [fe80::71d6:ec6e:fa92:b53%4]:123
Jan 17 11:37:33 ELAR-Systems ntpd[2712]: Listening on routing socket on fd #22 for interface updates
【问题讨论】:
-
日志文件中有什么内容吗?
-
@DanFromGermany 更新了问题
-
你确定你的时间没有同步吗?如果您使用的是树莓派 - 您无法随着时间的推移正确同步它,因为它没有内存和能力来保持时间稳定。
-
您在此处显示的所有内容都表明您的机器已同步,如果
ntpq -pn前面有一行带有星号的输出,则表明它当前已同步到 216.239.35.8。你怎么断定它没有同步? -
它非常小。只有 0.088 毫秒。甚至更差一百倍,8.8 毫秒,也将在人们对 NTP 的期望范围内。并且 ntpdate 只运行一次同步,它不会告诉 ntpd 与该服务器保持同步。
标签: ntp