首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NTP是否应该在手动更改后更新时间?

NTP是否应该在手动更改后更新时间?
EN

Server Fault用户
提问于 2016-03-07 12:53:57
回答 1查看 436关注 0票数 -2

我配置了NTP服务,并通过以下方式检查了它:

  1. 禁用NTP
  2. 调整时间
  3. 启用NTP

主持人的时间在几秒钟内确定下来。但如果我这么做了

  1. 启用NTP
  2. 调整时间

时间不是固定的。在这种情况下时间应该是固定的吗?

我按照命令设置时间,如/bin/date -s "4:2" && /sbin/hwclock -w

OS:Debian 3.2.68-1+deb7u5

ntp.conf (除server行外,所有默认值):

代码语言:javascript
复制
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

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


# You do need to talk to an NTP server or two (or three).
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

# 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>
#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst


# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
EN

回答 1

Server Fault用户

回答已采纳

发布于 2016-03-07 15:43:44

答案是“是和不是”。

当本地服务器和NTP服务器之间的差异太大时,ntp不会更新服务器上的时间(我认为这大约是0.5s?)。但是,当它检测到太大的差异时,它可以在一定时间后恢复时间来纠正,并决定这样做。

您可以使用以下方法更改时间:

代码语言:javascript
复制
tinker panic 0 stepout 120

它将在2分钟后返回正确的时间(如果我没有记错的话,默认为15 .当然要看执行情况而定。

,为什么?

NTP试图尽可能地保持时间的线性和真正的正确。如果差异太大,他不能保持正确,因为它可能需要很长时间来确定时间(修复大约是1-10毫秒)。

当您的本地时钟工作不正常且速度太慢时,在正常操作中也会发生太大的差异,因此差异越来越大,最终它变得如此之大,以至于ntpd拒绝再固定时间。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/762069

复制
相关文章

相似问题

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