Hi,
the Windows Time service includes both an NTP Client and an NTP Server. The NTP Server is disabled by default.
If your Windows Box should act as NTP Server config a valid time source first. Either a DCF77 (Germany) Receiver or an couple of NTP Servers which you trust.
For Germany I recommend to use the NTP Server from the “physikalisch-technische bundesanstalt”.
Lets start. Configure the Windows Time Service as NTP Client.
D:\> w32tm /config /syncfromflags:manual /update /manualpeerlist:ptbtime1.ptb.de,ptbtime2.ptb.de
Configure w32time Service to start automatically
D:\> sc config w32time start= auto D:\> net start w32time
Configure w32time as Server
D:\> w32tm /config /reliable:yes D:\> w32tm /config /update D:\> reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer /v Enabled /t REG_DWORD /d 1 /f D:\> net stop wuauserv D:\> net start wuauserv
Open Firewall
D:\> netsh advfirewall firewall add rule name="NTP Server" dir=out protocol=udp localport=123 profile=any enable=yes action=allow D:\> netsh advfirewall firewall add rule name="NTP Server" dir=in protocol=udp localport=123 profile=any enable=yes action=allow
Check configuration, a section NtpServer should appear
D:\> w32tm /query /configuration ... NtpServer (Local) DllName: C:\Windows\system32\w32time.dll (Local) Enabled: 1 (Local) InputProvider: 0 (Local) AllowNonstandardModeCombinations: 1 (Local) ...
Test it from another computer
C:\> w32tm /stripchart /computer:youtNTPServer /samples:4 /dataonly Tracking youtNTPServer[192.168.254.1:123]. Collecting 4 samples. The current time is 22.05.2018 22:53:55. 22:53:55 -00.0636377s 22:53:56 -00.0662772s 22:53:57 -00.0583119s 22:53:58 -00.0671685s
Michael
The syntax in: Lets start. Configure the Windows Time Service as NTP Client does not work in Windows Server 2019. Should be in quotes and a space between peers.
Also a hex value set to control peer type:
1. D:\> w32tm /config /syncfromflags:manual /update /manualpeerlist:”ptbtime1.ptb.de,0x9 ptbtime2.ptb.de,0x9″
The hex value could be desired to be something else, such as 0x2 for a fail back only option, but this is a good setting for stand alone time servers.
I don’t think you meant to restart Windows update in Configure w32time as Server steps 4 and 5. SHouldn’t that be:
4. D:\> net stop w32time
5. D:\> net start w32time
you are correct in that you can set in order of preference for windows 2019 and above using the hex flags, however the original command should still work too and give equal preference