• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar

KJBweb

Technical Notes & How To's

  • Home
  • How-to
  • Quick Fixes
  • Examples
  • Hardware
You are here: Home / How-to / How to Check NTP Connectivity and Function on the Command Line

How to Check NTP Connectivity and Function on the Command Line

August 3, 2018Leave a Comment

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:

[email protected]:~$ ntpdate -q pool.ntp.org
server 109.74.206.120, stratum 2, offset -0.001523, delay 0.04782
server 139.59.199.215, stratum 2, offset -0.003559, delay 0.04453
server 185.53.93.157, stratum 2, offset -0.006328, delay 0.04576
server 193.150.34.2, stratum 2, offset -0.001938, delay 0.04889
3 Aug 16:31:11 ntpdate[24082]: adjust time server 139.59.199.215 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:

[email protected]:~$ ntpdate -q pool.ntp.org
server 85.199.214.101, stratum 0, offset 0.000000, delay 0.00000
server 85.199.214.102, stratum 0, offset 0.000000, delay 0.00000
server 178.62.16.103, stratum 0, offset 0.000000, delay 0.00000
server 178.79.160.57, stratum 0, offset 0.000000, delay 0.00000
5 Jun 11:30:11 ntpdate[14437]: 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.

Filed Under: How-to Tagged With: bash, linux, ntp

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Recent Posts

  • How To Get SMETS1/2 Smart Meter Data into HomeAssistant the Easy Way
  • How to Install 7zip on Ubuntu 18.04 LTS (Bionic Beaver)
  • How to Install the NewRelic MySQL Plugin
  • Repair “Repository Error: database disk image is malformed” YUM Issue
  • How to Check NTP Connectivity and Function on the Command Line

Recent Comments

  • himanshu on How to Test Memcached Connectivity
  • moun on How to Perform a GET Request with CURL via the Command Line
  • Karl on How to Install rar/unrar on Ubuntu 18.04 LTS (Bionic Beaver)
  • John on How to Install rar/unrar on Ubuntu 18.04 LTS (Bionic Beaver)
  • How to Install rar/unrar on Ubuntu 16.04 LTS (Xenial) - KJBweb on How to Install rar/unrar on Ubuntu 18.04 LTS (Bionic Beaver)

Archives

  • November 2022
  • February 2019
  • August 2018
  • November 2016

Categories

  • Examples
  • Hardware
  • How-to
  • Quick Fixes

Copyright © 2023 · WordPress · Log in