To get info from the NTP server in the command line, type
w32tm /query /configuration
w32tm /query /status
Time /T
w32tm /query /configuration
gives you the configuration you have set up.
w32tm /query /status
gives you information such as:
- stratum
- leap indicator
- precision
- last sync
- NTP server
- poll interval
time /T
outputs the current system time.
Note: w32tm /query
was first made available in the Windows Time client versions of Windows Vista, and Windows Server 2008. See Windows Time Service Tools and Settings
Configuring w32time As NTP Client
The performance of w32time
as NTP client depends strongly on the w32time
software version. However, Microsoft has started to improve the accuracy you can achieve with w32time
if you run the versions that are shipped with Windows Server 2016, or Windows 10 version 1607, or later.
However, by default many versions of the w32time
(“Windows Time”) service shipped with Windows send “symmetric active peer” packets instead of “client” mode packets, and normally the NTP daemon (ntpd
) as an NTP server should not even reply to such packets, unless the “symmetric actice” packet really comes from an authenticated peer.
However, since many years ntpd
has implemented a workaround where it doesn’t handle such dumb peer requests as it would do for real peers, but anyway sends a reply, just to satisfy those w32time
clients.
Correctly Specifying an own NTP server
w32time
is the name of the service which is normally configured automatically to query the time from a domain controller in an Active Directory domain, if the machine is a member of an AD domain, or from one of Microsoft’s public NTP servers which can be accessed via time.microsoft.com
, if the machine is a standalone machine or an AD domain controller.
The w32tm
command, however, is an utility program that can be run in a console (cmd) window with administrator permissions to configure and monitor the w32time
service. The following commands can be used to specify the host name or IP address of an external NTP server to be queried, and check the current settings.
When specifying an NTP server then it may be required to add a specific flag to the host name or IP address, even though this is poorly documented by Microsoft. According to the Microsoft documentation at
- [MS-SNTP]: Abstract Data Model | Microsoft Docs
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-sntp/fef409e4-5297-4f18-850b-e386f7e10fea
the following flags are supported:
0x1 | SpecialInterval | Wait the for the special interval instead of the standard interval before sending the next query, see Registry Settings |
---|---|---|
0x2 | UseAsFallbackOnly | Use the specified NTP server as fallback only |
0x4 | SymmatricActive | Force sending symmetric active peer requests to the specified NTP server |
0x8 | Client | Force sending client requests to the specified NTP server |
As already mentioned above, some versions of w32time
use to send symmetric active peer
requests to NTP servers by default, but if the NTP server runs the standard NTP software (ntpd
) then the server may not reply to such unauthenticated peer requests at all. The normal behavior is to send client
requests to a server, in which case the server sends a server
reply.
So it’s safe to use flag 0x8, or a combination of other flags with 0x8, if required. E.g., 0x8
and 0x1
would result in a flag 0x9
.
So actually the following command can be used to specify a single server:
w32tm /config /manualpeerlist:[serverIP],0x8 /syncfromflags:MANUAL /update
or
w32tm /config /manualpeerlist:[serverDNS],0x8 /syncfromflags:MANUAL /update
Of course the IP address or the DNS hostname of the NTP server has to be entered instead of [server], and the flag 0x8 is appended after a comma, as explained above.
If several servers are to be configured for redundancy then the servers specified by /manualpeerlist
have to be separated by a space, so the whole parameter has to be enclosed in double quotes:
w32tm /config /manualpeerlist:"[server1],0x8 [server2],0x8" /syncfromflags:MANUAL /update
The parameter /update
makes sure the changes become effective immediately.
The following command can be used to check the list of servers (actually always labelled peers
) that are currently in use:
w32tm /query /peers
The output of this command also shows a mode
for each specified server/peer, which should be 3 (Client)
in most cases.
For other options of the w32tm
command please see the usage information displayed if the command is run without any parameter.
The net time …
command was used on older windows systems to configure the w32time
service. However, that command should be used only if the w32tm
utility is not available.
Registry Settings
The following settings are required on every node that runs w32time
to achieve the best results:
Registry Key | Value |
---|---|
MinPollInterval | 6 |
MaxPollInterval | 6 |
UpdateInterval | 100 |
SpecialPollInterval | 64 |
FrequencyCorrectRate | 2 |
These parameters are controlled via registry settings, or via the some group policies.
- Windows Time Service Registry Entries
https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings#w2k3tr_times_tools_uhlp
Be the first to comment