有没有人有将 Linux(特别是 Red Hat)同步到 Windows NTP 服务器的经验?目前我们的 Windows 服务器正在与互联网上的 1 层服务器同步,但 Linux 机器拒绝将其视为良好的时间源。
经过一番研究,我们发现我们的问题是根分散值可能太高。以下是 ntpq 的输出 -
ntpq> peers
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp1.ourdomain 10.10.10.1 4 u 20 128 377 0.376 1397.10 22.800
ntpq> ass
ind assID status conf reach auth condition last_event cnt
===========================================================
1 30939 90b4 yes yes none reject reachable 11
ntpq> rv 30939
assID=30939 status=90b4 reach, conf, 11 events, event_reach,
srcadr=ntp1.ourdomain.com, srcport=123, dstadr=10.10.10.2,
dstport=123, leap=00, stratum=4, precision=-6, rootdelay=93.750,
rootdispersion=2333.466, refid=10.10.10.1, reach=377, unreach=0, hmode=3,
pmode=4, hpoll=7, ppoll=7, flash=400 peer_dist, keyid=0, ttl=0,
offset=1369.793, delay=0.000, dispersion=21.915, jitter=15.387,
reftime=d7493cd7.fd3528d6 Mon, Jun 16 2014 10:52:23.989,
org=d74944eb.b857f9bc Mon, Jun 16 2014 11:26:51.720,
rec=d74944ea.5709a581 Mon, Jun 16 2014 11:26:50.339,
xmt=d74944ea.56ea01a7 Mon, Jun 16 2014 11:26:50.339,
filtdelay= 0.48 0.51 0.00 0.43 0.50 0.44 0.40 0.55,
filtoffset= 1380.34 1376.38 1369.79 1362.68 1360.75 1353.16 1349.80 1343.46,
filtdisp= 15.63 17.58 19.48 21.42 23.37 25.30 27.25 29.20
我想了解的是为什么这个值这么高,以及我们可以在 Windows 服务器上配置什么来改变它吗?
更新
以下是来自我们的 Windows NTP 服务器的一些信息 -
c:\Windows\System32>w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 2 (secondary reference - syncd by (S)NTP)
Precision: -6 (15.625ms per tick)
Root Delay: 0.0312500s
Root Dispersion: 1.2097655s
ReferenceId: 0x9E2BC042 (source IP: 158.43.192.66)
Last Successful Sync Time: 18/06/2014 04:41:16
Source: ntp2.pipex.net
Poll Interval: 15 (32768s)
c:\Windows\System32>w32tm /query /peers
#Peers: 2
Peer: ntp1.pipex.net
State: Active
Time Remaining: 6264.1144284s
Mode: 1 (Symmetric Active)
Stratum: 2 (secondary reference - syncd by (S)NTP)
PeerPoll Interval: 15 (32768s)
HostPoll Interval: 15 (32768s)
Peer: ntp2.pipex.net
State: Active
Time Remaining: 6264.1144284s
Mode: 1 (Symmetric Active)
Stratum: 1 (primary reference - syncd by radio clock)
PeerPoll Interval: 15 (32768s)
HostPoll Interval: 15 (32768s)
答案1
如果 ntpd 认为远程时钟存在较大偏差,它将拒绝时钟。您的 Linux 机器很可能拒绝 Windows TS,因为偏差高于恐慌阈值。假设 Windows 时间服务器运行正常,您应该考虑在-g
ntpd 调用中添加以下标志:
-g Normally, ntpd exits with a message to the system log if
the offset exceeds the panic threshold, which is 1000 s by
default. This option allows the time to be set to any value
without restriction; however, this can happen only once. If the
threshold is exceeded after that, ntpd will exit with a message
to the system log. This option can be used with the -q and -x
options.
或者将该panic
值设置为更高的值或零:
panic panic
Specifies the panic threshold in seconds with default 1000 s. If set to
zero, the panic sanity check is disabled and a clock offset of any value
will be accepted.
仅供参考:目前还不清楚您的 Windows 时间安装是否正常工作和/或是否按照您描述的方式配置。您提到 Windows 服务器正在同步到互联网上的第 1 层机器。但是您的同行公告牌显示 ntp1.ourdomain 处于第 4 层:
Stratum Machine description
1 ntp ref clock on internet
2 ?????????
3 ?????????
4 ntp1.ourdomain
5 linux boxes
对于延迟如此低的机器来说,抖动值也非常高,我认为这表明该机器位于同一本地网络上。
答案2
我通过在注册表中将其配置LocalClockDispersion
为 0解决了此问题(无法将 Linux NTP 客户端与 Windows NTP 服务器同步) 。HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Config