Linux – NTP not syncing automatically with the internal NTP server

centoslinuxntpntpdntpdate

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?

Best Answer

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.