Wednesday, 3 February 2016

Configuring NTP on Windows Server 2012


This is all you need if you want to keep it simple. Run using PowerShell as admin:

w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:MANUAL
Stop-Service w32time
Start-Service w32time


W32tm is the command to use. Sure, there are articles out there mentioning "net time", but you should not use that. Some other also mentions editing the registry directly, but as Microsoft mentions in the article: It is recommended that you do not directly edit the registry unless there is no other alternative. But if you really want to check the registry, it's here: HKLM\System\CurrentControlSet\Services\W32Time.

Which NTP-server to use? Or several?

The pool.ntp.org is a round-robin of random selected NTP servers. As they say "This is usually good enough for end-users". But you might want to add several NTP-servers yourself for redundancy?
w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org" /syncfromflags:MANUAL
Just keep adding them with a space in between them. Yes, I know some sites say you should separate them using comma but that doesn't work. Also, I've experienced issues that it configures correctly, but still after restarting the service, it doesn't work. I just needed to do the configuration again, and try once more. Also, remember that cut'n'paste from the web can sometimes screw up the " character so write it manually instead of cut'n'paste to be sure.

Don't forget your firewall

If you got a firewall between your host and the Internet, it might drop udp/123 which is the NTP protocol. 

No comments:

Post a Comment