How to install and configure NTP Server on Windws Server 2022
NTP, or Network Time Protocol, is a service that has access to highly precise atomic clocks. As a result, the NTP service provides consistent timekeeping on client and server resources and ensures accurate data logging. The purpose of this is to streamline global communications.
Below, we’ll discuss the process of installing, configuring, and querying an NTP server on Windows Server 2022.
INSTALL AND CONFIGURE AN NTP SERVER ON WINDOWS SERVER 2022
Follow the straightforward steps below to configure an NTP server on Windows Server 2022.
Confirm NTP service is Automatic
Open the Run dialogue (Windows key + R) and type “services.msc” (without the quotation marks) and click OK or hit Enter.
Locate “Windows Time” under the Services. Right-click the service and select Properties.
Change the Startup type to “Automatic”.
Once Startup type is confirmed, click “OK”.
NTP server registry configuration
Open the Run dialogue (Windows key + R) and type “regedit” (without the quotation marks) and click OK or hit Enter.
The registry editor will open as below.
Navigate to the below location:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer
In the pane on the right-hand side, double-click on the entry titled “Enabled”.
Change the DWORD value to “1”, leave the Base as Hexidecimal, and click “OK”
Now browse to the below location:
Computer>HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Services>W32Time>Config
In the right-hand pane, locate the “Announce Flags” entry.
Change the DWORD value data to “5”, leave the Base as Hexidecimal, and click “OK”
Return to the “services.msc”, locate the “Windows Time” service again, right-click on it and restart the service.
Configure NTP with PowerShell
Launch an administrator PowerShell session and run the below:
Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer” -Name “Enabled” -Value 1
Configure Announce Flags value:
Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Config” -Name “AnnounceFlags” -Value 5
Restart the NTP server:
Restart-Service w32Time
Note: NTP requires UDP port 123 open for Windows Server 2022 to be able to reach the clocks. If the servers are unreachable, please check your firewall configuration.
Useful Commands
Check NTP Configuration:
w32tm /query /configuration
Check NTP server list:
w32tm /query /peers
Force NTP server synchronization:
w32tm /resync /nowait
Show the source of the NTP time:
w32tm /query /source
Show status of NTP service:
w32tm /query /status
Conclusion
Windows Server 2022 is now configured to synchronize with pool.ntp.org. Therefore, all infrastructure should now be synchronized with the local NTP server.
Should NTP be configured on a virtual machine, ensure that the machine is set to only sync from the time service and not with the host machine.
Leave a Reply
Want to join the discussion?Feel free to contribute!