首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >立即关闭NTPD同步

立即关闭NTPD同步
EN

Server Fault用户
提问于 2016-08-10 06:22:27
回答 2查看 1.1K关注 0票数 -1

我的任务是将linux设备与ntp服务器同步。文档表示,默认情况下,ntpd检查系统时间和服务器时间之间的差异,如果偏移量在恐慌阈值(1000 s是默认的)内,ntpd将开始缓慢地校正系统时间。好吧,这对我很好,我需要那种行为。

我手动设置系统时间,然后启动ntpd。使用命令ntpq -c对等点,我可以查找同步过程。它显示设备连接到服务器并获取数据包。但在一两分钟后,系统时间发生了变化,向服务器时间迈出了一大步。这在我的情况下是不好的,我需要慢慢的纠正。我不知道为什么会这样!

我在不同的服务器和linux中尝试了这一点,一切都一样。

设备基于raspberry pi 2,linux映像构建与内置。

代码语言:javascript
复制
# 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

对此我找不到任何解释。所有的停顿都是关于在守护进程启动时同步时间有多快,但我需要相反。

所以,不知道.

EN

回答 2

Server Fault用户

发布于 2016-08-10 08:53:05

默认情况下,如果偏移量大于128 is,ntpd将分步(而不是直接执行)。您可以使用-x命令行选项来避免这种情况,但请注意:校正一秒钟的偏移量将花费大约2000秒,因此这可能需要很长时间。

代码语言:javascript
复制
 -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.
票数 6
EN

Server Fault用户

发布于 2016-08-10 06:41:07

对于一次性同步,可以使用两种不同的方法/协议:

  • ntpdate使用SNTP协议,而且速度非常快。
  • ntpd -q使用NTP协议,虽然速度较慢,但更准确。
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/795933

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档