NTP - localhost timeout - ソースネットワークは lo の代わりに eth0 を使用します。

NTP - localhost timeout - ソースネットワークは lo の代わりに eth0 を使用します。

Centos 6 サーバーでは、ntpq -p コマンドがタイムアウトしました。

# ntpq -pn
127.0.0.1: timed out, nothing received
***Request timed out

tcpdump の結果は、ループバックインタフェースの代わりに eth0 を使用することを示しています。

14:42:11.392517 IP 10.122.5.2.45969 > 127.0.0.1.ntp: NTPv2, Reserved, length 12
14:42:16.397594 IP 10.122.5.2.45969 > 127.0.0.1.ntp: NTPv2, Reserved, length 12
14:42:29.528535 IP 10.122.5.2.35338 > 127.0.0.1.ntp: NTPv2, Reserved, length 12

ネットワーク構成に問題があるようです。しかし、どこ?

私のntp.confの内容。

# cat /etc/ntp.conf
tinker panic 0

driftfile /var/lib/ntp/drift

server x.x.x.x iburst
server x.x.x.x iburst


# By default, exchange time with everybody, but don't allow configuration.
# See /usr/share/doc/ntp-doc/html/accopt.html for details.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

keys /etc/ntp/keys

ベストアンサー1

問題は、無効なiptables natルールが原因で発生します。

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  0.0.0.0/0            0.0.0.0/0

宛先を宛先IPに変更すると、ntpが機能し始めます。

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  0.0.0.0/0            x.x.x.x

おすすめ記事