我配置了NTP服务,并通过以下方式检查了它:
主持人的时间在几秒钟内确定下来。但如果我这么做了
时间不是固定的。在这种情况下时间应该是固定的吗?
我按照命令设置时间,如/bin/date -s "4:2" && /sbin/hwclock -w
OS:Debian 3.2.68-1+deb7u5
ntp.conf (除server行外,所有默认值):
# /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发布于 2016-03-07 15:43:44
答案是“是和不是”。
当本地服务器和NTP服务器之间的差异太大时,ntp不会更新服务器上的时间(我认为这大约是0.5s?)。但是,当它检测到太大的差异时,它可以在一定时间后恢复时间来纠正,并决定这样做。
您可以使用以下方法更改时间:
tinker panic 0 stepout 120它将在2分钟后返回正确的时间(如果我没有记错的话,默认为15 .当然要看执行情况而定。
NTP试图尽可能地保持时间的线性和真正的正确。如果差异太大,他不能保持正确,因为它可能需要很长时间来确定时间(修复大约是1-10毫秒)。
当您的本地时钟工作不正常且速度太慢时,在正常操作中也会发生太大的差异,因此差异越来越大,最终它变得如此之大,以至于ntpd拒绝再固定时间。
https://serverfault.com/questions/762069
复制相似问题