Raspberry Pi 3 时钟在重启后不会同步

Raspberry Pi 3 时钟在重启后不会同步

我有一台运行 Gentoo 的 Raspberry Pi 3,重启后时钟无法与 NTP 同步。系统重新启动后,它会从 swclock 恢复上次记录的时间。我必须手动启动 ntp-client 服务才能同步时钟。配置似乎正确,因为 swclock 处于启动级别,而 ntp-client 处于默认级别。

答案1

我在使用 DNSSec 时见过这种情况。如果时间相差太大,DNSSec 将无法解析 DNS 名称,因此 NTP 守护程序无法获取要同步的 IP 地址。

一种解决方案可能是确保至少一个 NTP 服务器或对等点是 IP 地址或本地可解析的名称。

named在我的一台 Pi 上运行,并将此代码片段添加到末尾/etc/default/bind9。我的两个server条目是显式 IP 地址,其他条目最终在 DNS 开始工作时得到解析。

# Get an approximation to current time so that DNS will work, so that
# NTP can resolve its server/peer names
#
test -x /usr/sbin/ntpdate -a -s /etc/ntp.conf &&
    awk '/^server|^peer/ {print $2}' /etc/ntp.conf | xargs -r ntpdate || :

相关内容