top of page
  • Writer's pictureRenan Antonio Rodrigues

How to configure NTP server in Active Directory, Step by step

If you want to know how to properly configure your Active Directory environment, including Domain Controllers and domain computers, to have a reliable time service working correctly and synchronizing with an external time server, this post shows how to do that in a very easy way.


Why?


Active Directory can't work correctly if the clock is not synchronized around domain controllers and member machines.


Some of the services that rely on the correct time configuration is Kerberos, which by default, computers that are more than 5 minutes out of sync will not authenticate to domain. Another example is replication, Active Directory uses time stamps to resolve replication conflicts, etc.


How Does it Work?

  1. In Active Directory, we use the Windows Time service for clock synchronization: W32Time;

  2. All member machines synchronizes with any domain controller;

  3. In a domain, all domain controllers synchronize from the PDC Emulator of that domain;

  4. The PDC Emulator of a domain should synchronize with any domain controller of the parent domain: using NTP;

  5. The PDC Emulator of the root domain in a forest should synchronize with an external time server, which could be a router, another standalone server, an internet time server, etc.

You can have a better idea about this flow in the following picture:


time-configuration-AD
time-configuration-AD

Said that, let's set up the time service.


Configuration


From your PDC, open the prompt as administrator and type:



w32tm /config /manualpeerlist:yourNTPserver,0x8 /syncfromflags:manual /reliable:yes /update

w32tm /resync /rediscover

net stop w32time && net start w32time

Where "yourNTPserver" should be the address of the external NTP source you want set up, it could be a pool in the Internet or your internal NTP server.


Note the ",0x8" is part of the command and it will set the PDC to force sending client requests to the specified NTP server, and not other different type of requests like symmetric, which could cause PDC to do not receive correct NTP answers.


Also, should you wish to add more than one NTP server in the command above you should put them within quotes and separated by a space, like that:

w32tm /config /manualpeerlist:"yourNTPserver1,0x8 yourNTPserver2,0x8" /syncfromflags:manual /reliable:yes /update

Confirm if your server is properly configured:

w32tm /query /status

The output from command above should show the peers you configured, if not something is wrong, double check firewall and other settings, more troubleshooting details below.


Once the PDC was correctly configured, force all other DCs to rediscover the new time server by configuring it to Domain Hierarchy with the commands below:

w32tm /config /syncfromflags:DOMHIER /update
w32tm /resync /nowait
net stop w32time && net start w32time

Check settings after a minute, it should show your PDC/Time Server:

w32tm /query /status

Once the commands above were executed in all DCs, check the NTP settings for them with the command below:

w32tm /monitor

The correct and expected output should be the PDC/NTP with Stratum = 3 and all other DCs with Stratum = 4


Firewall


Set your internal firewall and your perimeter firewall to allow outgoing and incoming NTP traffic from/to your server on 123 UDP port.


Virtual Server?


Don't forget, if your PDC is a virtual machine hosted on a Hyper-V server, you have to disable the time synchronization in your VM settings. To do that follow the instruction below:


1 - Open Hyper-V Manager.

2 - Select the Virtual Guest DC

3 - Click Settings.

4 - Click Integration services.

5 - Clear the Time Synchronization option.

6 - Exit Hyper-V Manager.

7 - Restart the server.


Screwed up configuration, what now?


Don't worry, you can restore time service to its default value:

net stop w32time
w32tm /unregister
w32tm /register

Errors?


If you are facing Event ID errors 47, or if your configuration has the source configuration set as "Local CMOS Clock", try:


1 - Do the above procedures again and be sure to set ",0x8" immediate after the NTP address without any spaces.

2 - Make sure you can reach your external NTP server through port UDP 123.

3 - Restart your server and try again.

4 - Make sure you don't have any other NTP setting being applied on your domain through GPO.

5 - Make sure your current time is not as far as 1000 seconds from the real time.

6 - Make sure your server is set at the right zone time.

7 - You can also check for time advertisement on the PDC by running this command w32tm.exe /resync /rediscover /no_wait, then check for Event ID 139

8 - You can check the registry entries if the domain controller is using NTP (should be on PDC) or NT5DS (on non-PDC):Find the value of Type under:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters

References:


For any doubts or suggestions, please leave a comment below.

133,788 views1 comment

Recent Posts

See All
bottom of page