目錄
問題現象
- 查看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
- 禁用NETWORKING_IPV6
[root@zfr sysconfig]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=yyy-hadoop1
NETWORKING_IPV6=no
- 重啓network
[root@zfr sysconfig]# service network restart
結果測試
[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
=============================================================================