You could have a firewall blocking port 123 which can cause the ntp server to never see time servers.
In my case my ISP (Internet Service Provider) was blocking ports.
A port scan of 123 didn't detect the blockage either.
The smoking gun was that I temporarily have two independent, internet feeds. In linux if I run ntpq -p
(repeatedly) with the first internet feed hooked up nothing gets updated, but with the other feed I get updates!
As @Jens A. Koch says, ntpdate -u <server name>
does go around this, well, temporarily (no pun intended), it does not fix the time issue long term.
Over time drift will occur in both your system and hardware clocks. Also in my case dual booting linux/windows causes the hardware clock to further get messed up (by hours).
So you must have port 123 open for UDP for to maintain your system clock.
Rather than using -u
, you can also do this which I think uses port 123 (rather than a non 'privileged' port):
service ntp stop
, then
ntpdate <server url>
(without the -u) and finally
service ntp start
.
This seems to bypass the port blockage issue, at least to set the clock one time. If -u
works, but this does not, then it's a pretty sure sign that the port is blocked, or the server is unresponsive, ...
Another issue that I had to solve was that for me the Debian default /etc/ntp.conf
configuration included 4 lines to the pools: debian.pool.ntp.org
. None of those servers worked. I got this error message:
Error resolving debian.pool.ntp.org: No address associated with
hostname (-5) 24 Mar 04:49:27 ntpdate[15115]: Can't find host
debian.pool.ntp.org: No address associated with hostname (-5) 24 Mar
04:49:27 ntpdate[15115]: no servers can be used, exiting
I had to change the servers to us.pool.ntp.org
.