-1 ntp time time-synchronization ntpd
我的任务是将 linux 设备与 ntp 服务器同步。文档说默认情况下 ntpd 检查系统时间和服务器时间之间的差异,如果偏移量在恐慌阈值内(默认为 1000 秒),ntpd 开始缓慢校正系统时间。好的,这对我有好处,我需要那种行为。
我手动设置系统时间,然后启动ntpd。使用命令 ntpq -c peers 我可以查找同步过程。它显示该设备链接到服务器并获取数据包。但是一两分钟后系统时间就向服务器时间迈出了一大步。这在我的情况下很糟糕,我需要慢慢纠正。我没有工作的想法为什么会这样!!!
我用不同的服务器和 linux mashine 尝试了这个,一切都一样。
基于树莓派 2 的设备,使用 buildroot 构建 linux 映像。
# ntpd --version
ntpd 4.2.8p2@1.3265-o Fri Jul 29 11:57:46 UTC 2016 (1)
#
# uname -a
Linux buildroot 3.18.12-v7 #3 SMP PREEMPT Thu May 12 17:53:44 MSK 2016 armv7l GNU/Linux
#
# cat /etc/ntp.conf
server 10.0.0.111 #my local server
driftfile /etc/ntp.drift
logfile /var/log/ntp/ntp.log
restrict 10.0.0.111 nomodify noquery #ban any packets from server, which send to modify local time
Run Code Online (Sandbox Code Playgroud)
我找不到任何关于此的解释。所有问题都是关于守护进程启动时同步时间的速度,但我需要相反。
所以,不知道.....
默认情况下,ntpd
如果偏移量大于 128 毫秒,将步进(而不是转换)时间。您可以使用-x
命令行选项来避免这种情况,但要注意:纠正一秒的偏移量大约需要 2000 秒,因此这可能需要很长时间。
-x Normally, the time is slewed if the offset is less than the step
threshold, which is 128 ms by default, and stepped if
above the threshold. This option sets the threshold to 600 s,
which is well within the accuracy window to set the clock
manually. Note: Since the slew rate of typical Unix kernels is
limited to 0.5 ms/s, each second of adjustment requires an
amortization interval of 2000 s. Thus, an adjustment as much as 600 s
will take almost 14 days to complete. This option
can be used with the -g and -q options.
Note: The kernel time discipline is disabled with this option.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
967 次 |
最近记录: |