Query NTP Server in Terminal

I have this desire to do as much as possible to ensure that devices on my local network do not require the Internet to function. Obviously, it isn’t ideal to be cut off from the World Wide Web but I want to ensure minimal disruption. One such disruption I had recently are some Tasmota dimmer switches that became sluggish and unresponsive when they lost access to Network Time Protocal services on the Internet. Adding a local NTP server is another step in limiting my need for Internet services.

My solution was to use my IPFire fire box as the NTP server as it was the easiest and frankly, most logical choice on my network for this service. In order to activate it, I used the instructions here to activate it and I pointed the devices to it as the primary NTP server. The next question I had, after pointing it, how do I verify that the IPFire box is doing what it is supposed to be doing? So I did a lot of searching and here is my solution to query the NTP server from the terminal on my openSUSE Linux machine:

Install and Run the Tool

In order to check an NTP server, get the needed information from it, I had to install “ntp.” Thankfully this is a common tool to be had in Linux. With openSUSE, it was as simple as:

sudo zypper install ntp

I’m quite certain the command for other distros would be swapping out “zypper” for your package manager.

Once the installation completed, as the root user, I ran this to check my local ipfire box:

ntpdate -q ipfire

This gave me the output:

server, stratum 11, offset +0.348358, delay 0.02744
17 Oct 20:26:17 ntpdate[2583]: adjust time server offset +0.348358 sec

This told me that I am getting the expected result from my local NTP server and now I have the confidence to point all my systems to that NTP server as primary in hopes of further reducing strain on my paltry connection to the Internet.

Final Thoughts

Network Time Protocol is a service that one might not thing much about. It’s one of those things that just happen automatically and so long as all your devices are working as they should, you may not realize how important it is to so many systems. If you have an Internet provider that never goes down, this may never be an issue for you. You may also be limited on your bandwidth or have a data usage cap and if you are looking at getting the best bang for your byte possible, this may be another solution for you maximize your experience. Obviously, the more machines you have on your network the greater the benefit. Setting up NTP locally is not much work but certainly has its benefits.


IPFire | Open Source, Linux based, Firewall, Install and Configuration

2 thoughts on “Query NTP Server in Terminal

  1. AFAIK, the default openSUSE NTP client/server is chrony – for example, querying a local NTP server on this private LAN –
    # chronyc ntpdata
    Remote address : (C0A8B201)
    Remote port : 123
    Local address : (C0A8B21B)
    Leap status : Normal
    Version : 4
    Mode : Server
    Stratum : 3
    Poll interval : 6 (64 seconds)
    Precision : -20 (0.000000954 seconds)
    Root delay : 0.011383 seconds
    Root dispersion : 0.015625 seconds
    Reference ID : 5C211797 ()
    Reference time : Mon Oct 18 08:43:56 2021
    Offset : -0.000423196 seconds
    Peer delay : 0.000261495 seconds
    Peer dispersion : 0.000000974 seconds
    Response time : 0.000476821 seconds
    Jitter asymmetry: +0.50
    NTP tests : 111 111 1111
    Interleaved : No
    Authenticated : No
    TX timestamping : Kernel
    RX timestamping : Kernel
    Total TX : 141
    Total RX : 141
    Total valid RX : 141

Leave a Reply