天天看點

ntp時間同步傳回“no server suitable for synchromization found”的排查ntpq -c versionservice iptables stop

背景:

報錯

登陸系統,先看看時間

1,檢視系統時間

date

hwclock --show 檢視硬體時間

2,檢視ntp.conf

ntp時間同步傳回“no server suitable for synchromization found”的排查ntpq -c versionservice iptables stop

3,手動同步,看看現場(多試幾個~)

ntp時間同步傳回“no server suitable for synchromization found”的排查ntpq -c versionservice iptables stop

4,使用調試模式看下

傳回如下:

5,根據debug到的報錯,有2個原因可能導緻該問題

5.1,檢查ntp的版本,如果你使用的是ntp4.2(包括4.2)之後的版本,在restrict的定義中使用了notrust的話,會導緻以上錯誤。

使用以下指令檢查ntp的版本:

下面是來自ntp官方網站的說明:

the behavior of notrust changed between versions 4.1 and 4.2.

in 4.1 (and earlier) notrust meant "don't trust this host/subnet for time".

in 4.2 (and later) notrust means "ignore all ntp packets that are not cryptographically authenticated." this forces remote time servers to authenticate themselves to your (client) ntpd

解決:

把notrust去掉。

5.2,檢查ecs的防火牆。可能是防火牆屏蔽了udp 123端口。(ecs的話還要注意安全組)

可以用指令停止防火牆測試

本例原因是iptables規則設定有問題導緻