1

ntpq -p commands are timing out for me in a centos 6 server.

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

tcpdump result shows me that it is using eth0 instead of loopback interface.

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

Looks as if like there is something wrong with the network configuration. But where?

my ntp.conf contents.

# 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
  • Stab in the dark here: are the server entries in your ntp.conf pointing to IP addresses? (It looks like you have sanitized your post.) If the entries are pointing to hostnames, is there an entry in the hosts file pointing these names to 127.0.0.1? – 0xSheepdog Jun 6 at 15:05
  • Yes, server entries in ntp.conf are pointing to IP addresses. There is no entry in hosts file for these IPs. – d95mtrx Jun 6 at 15:23
1

Issue was due to a faulty iptables nat rule.

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

Changed the destination to the IP it was intended for and ntp started working.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.