3

I installed ntp on a centos server.

I modified /etc/ntp.conf replacing the default server entries with one entry to my internal NTP server's IP (1.2.3.4 is the IP of the NTP server):

server 1.2.3.4 iburst

When I reboot the server and run ntpstat I see this:

unsynchronised
   polling server every 64 s

Then I run sudo ntpdate 1.2.3.4 and see this message:

1 Dec 19:22:35 ntpdate[2339]: the NTP socket is in use, exiting

Then I stop the service (systemctl stop ntpd) and run sudo ntpdate 1.2.3.4 again to see it sync successfully:

1 Dec 19:25:11 ntpdate[2351]: adjust time server 1.2.3.4 offset 0.005316 sec

Now when I start the service back up and run ntpstat I see this message:

synchronised to NTP server (1.2.3.4) at stratum 4
   time correct to within 8065 ms
   polling server every 64 s

If I reboot now and run ntpstat it will say unsynchronized. What am I doing wrong? It should be automatically syncing to the IP of the NTP server I put in the config file right?

  • how far off is it if you reboot again? as far as i can see, after running ntpdate and restarting ntpd, everything is fine - ntp makes small adjustments on its own after being 'roughed in' – pete Dec 2 '15 at 2:02
  • Wrong time zone on the client, out by too much for the version of ntpd running on it? Not saving time to BIOS on reboot? – tink Dec 2 '15 at 2:44
1

Looks like I was just being impatient. After a reboot if I wait about 6 minutes and ran ntpstat it will show it is synchronized.

The polling interval says 64 s which I assumed meant it polls every 64 s, but it looks like it doesn't work like that exactly.

  • 2
    Also, while the NTPD is running and you want to manually sync the time, you need to run this command instead so that it uses a different port (because the daemon is already using it): sudo ntpdate -u 1.2.3.4 – TheGrandPackard Dec 2 '15 at 17:42

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.