我正在同步4 Raspberry Pi时钟与一个Ubuntu服务器(全部在一个本地网络,通过以太网连接),使用NTP。所有设备都是脱机的,因此服务器只监听其本地时钟;实时并不重要。当我重新启动主机并启动NTP服务器时,客户端不能同步几分钟:命令
sudo ntpdate NTP-server-host抛出错误:
6月18日18:42:55 ntpdate一千五四六:没有适合同步的服务器
(NTP-服务器-主机对应于服务器的ip )工作了几分钟后。只有在重新启动之后才会发生这种情况。可能是什么原因?服务器正在运行,防火墙端口被打开。
服务器上的
driftfile /var/lib/ntp/ntp.drift
# Leap seconds definition provided by tzdata
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
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery客户端的
driftfile /var/lib/ntp/ntp.drift
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
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
pool 0.debian.pool.ntp.org iburst
pool 1.debian.pool.ntp.org iburst
pool 2.debian.pool.ntp.org iburst
pool 3.debian.pool.ntp.org iburst
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery
# Use specified ntp server
server NTP-server-host prefer iburst我只修改了ntp.conf文件,没有完全理解它们。如果有更深层次的人能向我展示其中的错误,那将是令人惊奇的。谢谢!
发布于 2019-07-03 16:55:18
这是完全正常的。NTP需要几个周期来稳定和开始服务时间。客户端部分还需要几个周期来接受服务器是稳定的,并且能够提供时间。
您可以通过运行以下命令来查看Ubuntu服务器的运行情况
ntpq -pn我还建议您从客户端的配置中删除池服务器,因为您说您的所有系统都脱机运行。
https://unix.stackexchange.com/questions/528236
复制相似问题