Press "Enter" to skip to content

ntpq -p timed out

问题现象

查看NTP连接的服务器发现请求超时

[root@zfr cmf]# ntpq -p

localhost: timed out, nothing received

***Request timed out

查看时间同步状态却显示正常

[root@zfr default]# ntpstat

synchronised to local net at stratum 11

time correct to within 12 ms

polling server every 64 s

问题分析

指定通过ipv4 地址获取返回值,正常显示

[root@zfr network-scripts]# ntpq -4p

remote refid st t when poll reach delay offset jitter

==============================================================================

LOCAL(0) .LOCL. 10 l 717 64 0 0.000 0.000 0.000

*100.64.252.252 10.237.42.215 5 u 83 128 377 2.406 9.419 11.271

指定通过ipv6 地址获取返回值,显示异常

[root@zfr network-scripts]# ntpq -6p

localhost: timed out, nothing received

***Request timed out
通过分析可以得出结论,操作系统开启了Ipv6 ,默认ntpq 先走Ipv6的通道。

而ECS  linux 默认无法直接访问ipv6地址,因此会访问超时。

解决办法

修改sysctl.conf文件,增加一行:net.ipv6.conf.all.disable_ipv6 = 1

[root@zfr cmf]# vi /etc/sysctl.conf



# Controls the maximum shared segment size, in bytes

kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages

kernel.shmall = 4294967296

net.ipv6.conf.all.disable_ipv6 = 1

结果测试

[root@zfr sysconfig]# ntpq -p

remote refid st t when poll reach delay offset jitter

==============================================================================

LOCAL(0) .LOCL. 10 l 809 64 0 0.000 0.000 0.000

100.64.252.252 .XFAC. 16 u 1951 16 0 0.000 0.000 0.000

[root@yyy-hadoop1 sysconfig]# ntpq -p

remote refid st t when poll reach delay offset jitter

=============================================================================

注:本文转自https://blog.csdn.net/zfr629/article/details/100079215

Be First to Comment

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注