1

I'm trying to configure NTP client on RHEL7.4 I'm running the "ntpstat" command and seeing that I have synchronized:

[root@my-machine ~]# ntpstat
synchronised to NTP server (ntp-server ip) at stratum 5
   time correct to within 1173 ms
   polling server every 64 s

but when I'm running the "ntpq -p" command, I'm getting an error:

[root@my-machine ~]# ntpq -p
localhost.ntp-server.com: timed out, nothing received
***Request timed out

For some reason NTP has appended a prefix of "localhost" to ntp-server hostname.

Here is my /etc/ntp.conf:

[root@my-machine ~]# egrep -v '^#|^[[:blank:]]*$' /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
server ntp-server.com prefer iburst

I should make the "ntpq" command working as this machine part of Cloudera cluster and cloudera-agent using the "ntpq -np" to be sure that NTP is synchronized.

1
  • my guest is that your host machine is serving NTP to your VM and you doesn't really need ntp.
    – Kiwy
    Commented May 4, 2018 at 6:21

1 Answer 1

0

I have solved the issue. For some strange reason it was lack of localhost lines in /etc/hosts at all.

So I have appended the lines bellow to /etc/hosts :

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Once I added such lines, the issue was solved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .