我在 centos 8 系统上安装了 chrony,它每 2 天将未来的时间设置大约 2 小时。我必须不断重新启动服务并ntpdata
修复它,这很烦人。我尝试过摆弄配置,但我不太确定该怎么做。有任何想法吗?
这是我的配置:
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 2.centos.pool.ntp.org iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1000 10
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *
# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2
# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 192.168.1.0/24
# Serve time even if not synchronized to a time source.
#local stratum 10
# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys
# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC
# Specify directory for log files.
logdir /var/log/chrony
# Select which information is logged.
#log measurements statistics tracking
[server ~]$ chronyc tracking
Reference ID : A29FC87B (time.cloudflare.com)
Stratum : 4
Ref time (UTC) : Fri Mar 25 08:22:28 2022
System time : 3662.770263672 seconds fast of NTP time
Last offset : +0.000199583 seconds
RMS offset : 37.570960999 seconds
Frequency : 14.564 ppm slow
Residual freq : -0.000 ppm
Skew : 0.007 ppm
Root delay : 0.038045153 seconds
Root dispersion : 0.000602906 seconds
Update interval : 1036.4 seconds
Leap status : Normal
[server ~]$ date
Fri Mar 25 11:31:15 EET 2022
答案1
您的时钟运行速度可能比内核可以纠正的速度快。这可能是硬件或内核问题,例如虚拟机上的问题。
检查 打印的频率值chronyc tracking
。如果它大于 100000 ppm,您将需要通过将指令更改makestep
为来永久启用时钟步骤:
makestep 1 -1
但如果您无法修复时钟,这只能作为最后的手段。