Any computer needs to have accurate and accurate date and time, and keeping time accurately without the use of NTP nowadays is troublesome given CPU tics cannot be relied upon in the virtualised world, and falling back to BIOS clocks is long considered bad practice given secure communication relies upon having time within a threshold of whom it wishes to communicate with.
With that said, Network Time Protocol configuration can be a pain the ass, especially considering it doesn’t tend to play well with basic Telnet connectivity checks either; this means you need a way to properly query the NTP server you’re targeting, and here’s how to do that on the Linux command line.
Querying an NTP Server on the Command Line
If all is well in your environment, after issuing the ntpdate command you should expect to wait a few seconds before being greeted with this response:
user@standard-machine:~$ ntpdate -q pool.ntp.org server 126.96.36.199, stratum 2, offset -0.001523, delay 0.04782 server 188.8.131.52, stratum 2, offset -0.003559, delay 0.04453 server 184.108.40.206, stratum 2, offset -0.006328, delay 0.04576 server 220.127.116.11, stratum 2, offset -0.001938, delay 0.04889 3 Aug 16:31:11 ntpdate: adjust time server 18.104.22.168 offset -0.003559 sec
Here you can see the server’s queried in the pool specified and other particulars such as the delays, offset, etc…
If your machine cannot reach the NTP server, then you’ll see something like this:
user@standard-machine:~$ ntpdate -q pool.ntp.org server 22.214.171.124, stratum 0, offset 0.000000, delay 0.00000 server 126.96.36.199, stratum 0, offset 0.000000, delay 0.00000 server 188.8.131.52, stratum 0, offset 0.000000, delay 0.00000 server 184.108.40.206, stratum 0, offset 0.000000, delay 0.00000 5 Jun 11:30:11 ntpdate: no server suitable for synchronization found
The key phrase to be looking for here is on the last line, stating no server could be found.
If you run into this, check your firewalls are allowing traffic from your host to your destination on port 123 over UDP.
Hope this helps, and please checkout some of my other posts for various how-to’s and ramblings.