我正在尝试将运行Ubuntu16.04.3LTS的Intel NUC上的时间与运行在Windows PC上的NTP服务器同步。
我已经检查了NTP服务器是否正确运行。
在我看来,服务似乎没有从配置文件/etc/systemd/timesyncd.conf
中读取
timedatectl status
输出
Local time: Wed 2019-01-16 21:32:01 CET
Universal time: Wed 2019-01-16 20:32:01 UTC
RTC time: Wed 2019-01-16 20:32:01
Time zone: Europe/Vienna (CET, +0100)
Network time on: yes
NTP synchronized: no
RTC in local TZ: no
systemctl status systemd-timesyncd
在systemctl restart systemd-timesyncd
之后的输出
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor pr
Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: active (running) since Wed 2019-01-16 21:36:08 CET; 11s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 2316 (systemd-timesyn)
Status: "Idle."
CGroup: /system.slice/systemd-timesyncd.service
└─2316 /lib/systemd/systemd-timesyncd
Jan 16 21:36:08 coretv systemd[1]: Starting Network Time Synchronization...
Jan 16 21:36:08 coretv systemd[1]: Started Network Time Synchronization.
我在/etc/systemd/timesyncd.conf
中的配置文件
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.
[Time]
NTP=192.168.20.1
#FallbackNTP=ntp.ubuntu.com
如果它有任何改变,所有命令都会以root用户身份在ssh连接上运行。
我遗漏了什么吗?
我没有时间再玩这个问题了。我将在我的终端上使用一个解决方案,这样我就不必依赖系统时间。
答案仍然值得赞赏,因为修复这将是一个更清洁的解决方案。
发布于 2020-05-22 16:59:57
我意识到这是一个老问题,但最近我遇到了同样的问题,我想分享我的解决方案,以便其他人可以避免花费数小时来解决这个问题。
对我来说,问题在于timesyncd.conf中的timesyncd.conf参数。默认为5秒;但是,当查看Wireshark中的NTP数据包时,根分散值约为10秒。我认为systemd-timesyncd忽略了所有的NTP数据包,因为根色散值高于最大值。
为了解决这个问题,我修改了timesyncd.conf,取消了对以RootDistanceMaxSec开头的行的注释,并将值更新为比我在NTP数据包中看到的根色散值大几秒的数字。然后我重新启动了我的系统,一切都很完美。
希望这能帮到外面的人节省几个小时。
https://askubuntu.com/questions/1110282
复制相似问题