![NTP - localhost 시간 초과 - 소스 네트워크가 lo 대신 eth0을 사용합니다.](https://linux55.com/image/154917/NTP%20-%20localhost%20%EC%8B%9C%EA%B0%84%20%EC%B4%88%EA%B3%BC%20-%20%EC%86%8C%EC%8A%A4%20%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC%EA%B0%80%20lo%20%EB%8C%80%EC%8B%A0%20eth0%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%A9%EB%8B%88%EB%8B%A4..png)
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