'ntptest' - Check NTP server
ntptest
is a command line utility that can be used to query the current time and status from an NTP server.
The data fields of the response packet from the server as well as the fields from the request packet sent to the server
are displayed in detail, so this is very useful to see which data an NTP server sends to its clients.
This program needs to be run in a command line / terminal window (cmd.exe
on Windows).
General Usage
Just run the program by typing
ntptest <hostname>
where, of course, <hostname>
has to be replaced by the DNS name or IP address of the NTP server to be queried.
The command
ntptest -?
shows some usage information including the command line options that can be used to define the exact behavior.
Monitoring An NTP Server
If ntptest
is called with the -Z
option, it sends 4 requests/sec to the server,
and the initial time offset is compensated, so you can even see how the offset develops over time:
ntptest -Z <hostname>
The output is something like:
ntptest v1.10, (c) Meinberg 2014-2018, contact: <martin.burnicki@meinberg.de> Host <hostname>, running continuously Initial time offset -0.000169012 will be compensated 2018-11-08 09:33:16.640653559, st 1, leap 0, offs[ms]: +0.115 2018-11-08 09:33:16.891949683, st 1, leap 0, offs[ms]: +0.131 2018-11-08 09:33:17.143102303, st 1, leap 0, offs[ms]: +0.113 2018-11-08 09:33:17.394358585, st 1, leap 0, offs[ms]: +0.126 ...
If you run the program against an NTP server while the server handles a leap second, you can observe how the server adjusts the leap bits, or if the server smears the time to hide the leap second from its clients.
Download Links
Here is an executable program for Windows. The ZIP archive has been updated and now contains an openSSL DLL that was missing from an earlier version. The DLL is required to support symmetric keys:
And the source code for Windows:
Source code for Linux or FreeBSD:
Public git repo of the source code:
Changelog
v1.11 -- 2019-09-04
- Return specific exit codes in case of error, and list the valid exit codes in the usage information.
- Support building against openSSL v1.1.1.
v1.10 -- 2018-07-31
- Support symmetric MD5 keys.
- Configurable number for request packet mode.
- Print request packet even if no response was received.
- Support build on FreeBSD.
v1.9 -- 2018-04-09
- Don't print min/max results after single query.