Linux ntpd, ntp, ntpdate not updating

One server did not want to update it’s time and it was 12 minutes adrift of the other servers that I run. This is on an older Redhat linux installation and not my usual flavours of SME Server and Debian.

I messed around for a while ending up with the following:

[user@server]# ntpdate -v -b au.pool.ntp.org
11 Oct 08:32:47 ntpdate[27088]: ntpdate 4.1.2@1.892 Tue Feb 24 06:32:26 EST 2004 (1)
11 Oct 08:32:47 ntpdate[27088]: the NTP socket is in use, exiting

At the very start I had tried to run ntpdate and it advised that the socket was in use. This is correct if ntpd the daemon is running which it was.

[user@server]# date
Mon Oct 11 08:32:58 EST 2010
[user@server]# ntpdate -v -b 127.0.0.1
11 Oct 08:33:18 ntpdate[27102]: ntpdate 4.1.2@1.892 Tue Feb 24 06:32:26 EST 2004 (1)
11 Oct 08:33:18 ntpdate[27102]: the NTP socket is in use, exiting

So i checked the date and it was still 12 minutes out. Which said that ntpd was not updating for whatever reason as according to my reading of the options it should.

[user@server]#
[user@server]# /etc/init.d/ntpd stop
ntpd: Removing firewall opening for 0.pool.ntp.org port 123iptables: Bad rule (does a matching rule exist in that chain?)
[FAILED]
ntpd: Removing firewall opening for 1.pool.ntp.org port 123iptables: Bad rule (does a matching rule exist in that chain?)
[FAILED]
ntpd: Removing firewall opening for 2.pool.ntp.org port 123[ OK ]
ntpd: Removing firewall opening for 3.pool.ntp.org port 123iptables: Bad rule (does a matching rule exist in that chain?)
[FAILED]
Shutting down ntpd: [ OK ]

Next I played with stopping ntpd and found that I got firewall errors, but worked out that was because I had modified /etc/ntp.conf to look at different servers in the pool.ntp.org range prior to the shutdown so the firewall rules that it was expecting to find did not exist. Doing it again showed not such errors.

[user@server]# /etc/init.d/ntpd start
ntpd: Opening firewall for input from 0.pool.ntp.org port 1[ OK ]
ntpd: Opening firewall for input from 1.pool.ntp.org port 1[ OK ]
ntpd: Opening firewall for input from 2.pool.ntp.org port 1[ OK ]
ntpd: Opening firewall for input from 3.pool.ntp.org port 1[ OK ]
Starting ntpd: [ OK ]
[user@server]# date
Mon Oct 11 08:35:14 EST 2010
[user@server]# /etc/init.d/ntpd stop
ntpd: Removing firewall opening for 0.pool.ntp.org port 123[ OK ]
ntpd: Removing firewall opening for 1.pool.ntp.org port 123[ OK ]
ntpd: Removing firewall opening for 2.pool.ntp.org port 123[ OK ]
ntpd: Removing firewall opening for 3.pool.ntp.org port 123[ OK ]
Shutting down ntpd: [ OK ]

Having stopped ntpd I then ran ntpdate successfully and restarted ntpd.

[user@server]# ntpdate -v -b 127.0.0.1
11 Oct 08:35:51 ntpdate[27201]: ntpdate 4.1.2@1.892 Tue Feb 24 06:32:26 EST 2004 (1)
11 Oct 08:35:55 ntpdate[27201]: no server suitable for synchronization found
[user@server]# ntpdate -v -b au.pool.ntp.org
11 Oct 08:36:03 ntpdate[27215]: ntpdate 4.1.2@1.892 Tue Feb 24 06:32:26 EST 2004 (1)
11 Oct 08:48:05 ntpdate[27215]: step time server 220.233.79.177 offset 721.705455 sec
[user@server]#

Has this fixed it ? Don’t know but I think the issue was that the servers that were listed in ntp.conf were incorrect. I have changed them now to a more appropriate au.pool.ntp.org selection and I’ll monitor the time over the next week or two.

Leave a Reply

Your email address will not be published. Required fields are marked *