ntp同步问题追查



查看ntpd启动状态


service ntpd start/stop/restart/status


# 查看ntp的端口,是否可以看到123端口
netstat -unlnp | grep ntp      


# 查看ntp服务器有无和上层连通
ntpstat


synchronised to NTP server () at stratum 2
time correct to within 74 ms
polling server every 128 s
# 注意:此命令出现上述synchronised结果比较慢。
——————————————————————————————————

ntpq -p


查看ntp服务器与上层ntp服务器的状态:ntpq


[root@data01 ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 61-216-153-104. 211.22.103.157   3 u 213m 1024    0  110.694   47.411   0.000
+ntp3.itcomplian 10.6.30.8        6 u  163 1024  157  408.690  -71.435  35.453
 gus.buptnet.edu 10.3.8.150       5 u  206 1024  331   11.849   -2.486  31.750
*ntp.wdc1.us.lea 130.133.1.10     2 u  417 1024  377  241.163  -12.288  18.173


# 其中:
# remote - 本机和上层ntp的ip或主机名,“+”表示优先,“*”当前所用的同步服务器
# refid  - 参考上一层ntp主机地址
# st     - stratum阶层
# when   - 上一次校正时间与现在时间的差值。
# poll   - 本地和远程服务器多少时间进行一次同步,单位秒,在一开始运行NTP的时候这个poll值会比较小,服务器同步的频率大,可以尽快调整到正确的时间范围,之后poll值会逐渐增大,同步的频率也就会相应减小
# reach  - 是一种衡量前8次查询是否成功的位掩码值,377表示都成功,0表示不成功。
# delay  - 网络延时,单位是10的-6次方秒。
# offset - 本地NTP服务器与远程NTP服务器的时间偏移。
# jitter - 统计了在特定个连续的连接数里offset的分布情况。简单地说这个数值的绝对值越小,主机的时间就越精确


如果所有远程服务器的jitter值是4000并且delay和reach的值是0,那么说明时间同步是有问题的。


——————————————————————————————————————————————————

查看ntp服务器与上层间的联系:ntptrace


ntptrace -n 127.0.0.1


127.0.0.1: stratum 3, offset -0.001095, synch distance 0.532610
116.193.83.174: timed out, nothing received


————————————————————————————

[root@data01 ~]# ntptime
ntp_gettime() returns code 0 (OK)
  time ddc7b43c.647b02b0  Tue, Nov 28 2017 18:09:00.392, (.392502425),
  maximum error 1274517 us, estimated error 24500 us, TAI offset 0
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset -28966.227 us, frequency 22.090 ppm, interval 1 s,
  maximum error 1274517 us, estimated error 24500 us,
  status 0x2001 (PLL,NANO),
  time constant 10, precision 0.001 us, tolerance 500 ppm,


[sa_cluster@BJSH-DATAHARBINGER-138-125 ~]$ ntptime
ntp_gettime() returns code 5 (ERROR)
  time ddc8bcde.563a4000  Wed, Nov 29 2017 12:58:06.336, (.336826),
  maximum error 16000000 us, estimated error 16 us, TAI offset 0
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 1 s,
  maximum error 16000000 us, estimated error 16 us,
  status 0x4041 (PLL,UNSYNC,MODE),
  time constant 7, precision 1.000 us, tolerance 500 ppm,


# returns code: 0 表示同步正常, 5 表示同步失败
# 它使用ntp_gettime() 系统调用读取并显示与时间相关的内核变量




——————————————————————————————————————


ntp 日志


查看ntp日志,看有无异常错误


/var/log/ntp.log
/var/log/messages
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值