Introduction
Let’s see how you can configure NTP Server on Windows Server 2019/2022. The Windows Time service uses the Network Time Protocol (NTP) to help synchronize time across a network. NTP is an Internet time protocol that includes the discipline algorithms necessary for synchronizing clocks (Microsoft Docs).
Step 1: Open up Registry Editor
Click on the start icon in your Server and search for “Run” application. From the “Run” application, type in “regedit” and hit “Enter”. This will fire up our Registry Editor as shown below.
A Window similar to the one below will ensue
Step 2: Go to the NtpServer Path
Follow the following Registry tree to arrive where our target configuration lies. Computer>HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Services>W32Time>TimeProviders>NtpServer.
The image below shows us at the end of the tree. As you can see, the right pane has files which are what as are looking for.
Step 3: Enable NtpServer
Double click on “Enabled” file which will open a small window. On the window, there is a part called “Value data”. Change the value from 0 to 1 as illustrated below. Click “OK” after changing.
Step 4: Make the AnnounceFlags 5
Within this path: Computer>HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Services>W32Time>, go into “Config”, that is: Computer>HKEY_LOCAL_MACHINE>SYSTEM>CurrentControlSet>Services>W32Time>Config.
While there, you will see a file named “AnnounceFlags” on the right pane as shown above. As you can guess, double click on it. That will open a small window similar to the one in Step 3. Under “Value data“, change the value from a to 5.
From Microsoft, the following are the description of all available AnnounceFlags:
Entry controls whether this computer is marked as a reliable time server. A computer is not marked as reliable unless it is also marked as a time server.
- 0x00 Not a time server
- 0x01 Always time server
- 0x02 Automatic time server
- 0x04 Always reliable time server
- 0x08 Automatic reliable time server
The default value for domain members is 10. The default value for stand-alone clients and servers is 10.
Step 5: Restart NtpServer
Open up “Services” by hitting on the Windows key and searching for Services. Once open, look for “Windows Time”. Right-click on it and click on “Restart“
Step 6: Open UDP port 123 in Firewall
For this, follow How To open a port in Windows Server Firewall guide. Remember that this port is UDP and not TCP.
Configure NTP Server on Windows Server using PowerShell
If you are a PowerShell person, then open up your Powershell as administrator and run the commands below and you will be good go.
Enable NtpServer
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\w32time\TimeProviders\NtpServer" -Name "Enabled" -Value 1
Make the AnnounceFlags 5
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\services\W32Time\Config" -Name "AnnounceFlags" -Value 5
Restart NtpServer
Restart-Service w32Time
If firewall is running allow NTP Port:
New-NetFirewallRule `
-Name "NTP Server Port" `
-DisplayName "NTP Server Port" `
-Description 'Allow NTP Server Port' `
-Profile Any `
-Direction Inbound `
-Action Allow `
-Protocol UDP `
-Program Any `
-LocalAddress Any `
-LocalPort 123
Conclusion
Now our NTP Server is ready to synchronize time across your network. Next, we are going to add our clients and then enjoy better time synchronization. Thank you for spending your time on the site and for reading through. There are a bunch of more guides for you on the blog, just look below for a sample.
Install and Configure Windows Admin Center on Windows Server
Install Windows Terminal on Windows / Windows Server
How to Allow ICMP Echo Reply on Windows Server
Install and Configure OpenSSH Server on Windows Server
Install and Configure FTP Server on Windows Server
Install and Configure iSCSI Target on Windows Server
How to run Linux on Windows Server with WSL