[日志]offset 正负
机器A上执行:
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 213 64 30 0.000 0.000 0.000
*B 182.92.12.11 3 u 41 64 77 0.117 -2164.9 0.688
表示: 机器A比机器B 快2s钟
[1] 10:13:08 [SUCCESS] B
Thu Jul 27 10:13:08 CST 2017
[2] 10:13:08 [SUCCESS] A
Thu Jul 27 10:13:10 CST 2017
[日志]time reset
17 Jun 21:52:12 ntpd[6771]: time reset -47.573538 s
step && slew 阀值
[测试]ntp server时间倒退对ntp client的影响
ntp client:C
ntp server:S
场景1:client不使用-x
场景1.1:跳变来自server
为了达到测试目的,我们将B设置为local的状态,不是其它的server的影响
机器B:
#ntpq -np
remote refid st t when poll reach delay offset jitter
==============================================================================
*127.127.1.0 .LOCL. 10 l 57 64 17 0.000 0.000 0.000
在没有使用-x的情况下,如果ntp server B 时间忽然倒退4s,那么 机器A会跟着直接倒退吗??
机器B倒退:4s
[1] 10:32:56 [SUCCESS] C
Thu Jul 27 10:32:56 CST 2017
[2] 10:32:56 [SUCCESS] S
Thu Jul 27 10:32:52 CST 2017
结果: client 会跟着倒退
日志报错是:clock_step 不是time reset
27 Jul 10:28:48 ntpd[238721]: 0.0.0.0 c515 05 clock_sync
27 Jul 10:35:31 ntpd[238721]: 0.0.0.0 0613 03 spike_detect -3.949780 s
27 Jul 10:46:43 ntpd[238721]: 0.0.0.0 061c 0c clock_step -3.949112 s
27 Jul 10:46:40 ntpd[238721]: 0.0.0.0 0614 04 freq_mode
场景1.2:跳变来自client
场景1.2.1:跳变来自client,时间快进,预期会倒退
[1] 11:04:27 [SUCCESS] C
Thu Jul 27 11:04:25 CST 2017
[2] 11:04:27 [SUCCESS] S
Thu Jul 27 11:04:23 CST 2017
场景1.2.2:跳变来自client,时间倒退,预期会快进
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 332 64 40 0.000 0.000 0.000
*S LOCAL(0) 11 u 3 8 377 0.075 4152.11 0.067
27 Jul 11:11:08 ntpd[100258]: 0.0.0.0 c515 05 clock_sync
27 Jul 11:13:41 ntpd[100258]: 0.0.0.0 0613 03 spike_detect +4.152511 s
27 Jul 11:27:01 ntpd[100258]: 0.0.0.0 061c 0c clock_step +4.151101 s
27 Jul 11:27:05 ntpd[100258]: 0.0.0.0 0614 04 freq_mode
场景2:client使用-x
如下,server 时间倒退2s
[1] 10:40:44 [SUCCESS] C
Thu Jul 27 10:40:46 CST 2017
ntp 79665 0.0 0.0 31248 1680 ? Ss 10:38 0:00 /usr/sbin/ntpd -u ntp:ntp -g -x
[2] 10:40:44 [SUCCESS] S
Thu Jul 27 10:40:44 CST 2017
ntp 86468 0.0 0.0 31248 1680 ? Ss 10:37 0:00 /usr/sbin/ntpd -u ntp:ntp -g
client:
#ntpq -np
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 224 64 30 0.000 0.000 0.000
*server LOCAL(0) 11 u 6 8 377 0.065 -2133.0 13.464
结果:
client 会逐渐逼近server但是不会一次性倒退
这里是slew的缓慢同步,slew同步没有日志,只有step的方式才有日志
#ntpq -np
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 224 64 30 0.000 0.000 0.000
*10.218.250.171 LOCAL(0) 11 u 6 8 377 0.065 -2133.0 13.464
等待。。。
#ntpq -np
remote refid st t when poll reach delay offset jitter
==============================================================================
127.127.1.0 .LOCL. 10 l 1072 64 0 0.000 0.000 0.000
*10.218.250.171 LOCAL(0) 11 u 6 8 377 0.066 -1686.3 17.906
REF
http://tianxiamall.blog.163.com/blog/static/20848911220152186413732/