You can check your NTP (Network Time Protocol) server configuration and status using command-line tools specific to your operating system. Here are instructions for Windows and Linux.
Checking NTP Server on Windows
Here's how to check which NTP servers your Windows system is configured to use and their status:
-
Open Command Prompt: Click on the Windows button, type
cmd
in the search bar, and press Enter. You may need to select "Command Prompt" from the list of search results. -
Run the w32tm Command: In the command prompt window, type the following command and press Enter:
w32tm /query /peers
-
Interpret the Results: The output will show a list of configured NTP servers. Each entry will provide information about the server's status. A good server should show an
Offset
close to zero and a positiveDelay
.
Example Output:
NTP Service is stopped.
The following NTP servers are configured:
time.windows.com,0x8
This example shows that the NTP service is currently stopped, but the configured NTP server is time.windows.com
. The ,0x8
part represents flags related to the server configuration.
To get more detailed status, you can use the following command:
w32tm /query /status
This command will display details about the NTP client configuration, including the source of the time and stratum level.
Checking NTP Server on Linux
The method for checking the NTP server on Linux depends on the NTP client being used. The two most common are ntpd
and chronyd
.
Checking with ntpd
-
Check the NTP server configuration file: Usually located at
/etc/ntp.conf
. This file contains the list of NTP servers being used. You can open it with a text editor (e.g.,sudo nano /etc/ntp.conf
). -
Use
ntpq
command: Thentpq
command is a utility for monitoring and querying thentpd
daemon. Run the following command:ntpq -p
The output will show a list of NTP servers along with their status. Key columns include:
remote
: The hostname or IP address of the NTP server.refid
: The server from which the remote NTP server is getting its time.st
: Stratum level (lower is better).t
: Type (usuallyu
for unicast).when
: How long ago the last packet was received.poll
: The polling interval (in seconds, as a power of 2).reach
: An octal value indicating the reachability of the server. A value of 377 indicates the server is reachable.delay
: Round trip delay to the server (in milliseconds).offset
: Time offset between the local clock and the server (in milliseconds). Ideally, close to zero.jitter
: A measure of the variability in the offset (in milliseconds).
The server marked with an asterisk (*) is the currently synchronized server.
Checking with chronyd
-
Use
chronyc sources
command:chronyc
is the command-line interface forchronyd
. To see the current time sources, use:chronyc sources
The output shows a list of configured NTP servers and their status. Key columns include:
MS
: Mode.^
means server,=
means peer.Name/IP address
: The hostname or IP address of the NTP server.Stratum
: Stratum level.Poll
: The polling interval (in seconds, as a power of 2).Reach
: An octal value indicating the reachability of the server.LastRx
: How long ago the last packet was received.Last sample
: The offset and skew values.
The server marked with an asterisk (*) is the currently synchronized server.
-
Use
chronyc sourcestats
command: For more detailed statistics, use:chronyc sourcestats
This command provides information about the estimated error bounds, offset, and frequency of each source.
By using these commands on either Windows or Linux, you can effectively check your NTP server configuration and status, ensuring your system maintains accurate time synchronization.