Backtrack:  
 
by lunarg on October 3rd 2011, at 11:37

Basic

The following was tested on a Windows 2003 R2 with SP2, but it should work on every system with w32time installed.

Open up a command prompt (start, run, cmd.exe, you know).

Then punch in these lines:

net time \\your-server-name /setsntp:some-ip-or-pool.ntp.org
net stop w32time
net start w32time

The way NTP works, the sync does not occur immediately, but it should be visible within a few minutes after w32time has started again.

Notice
If it doesn't work for you, check whether your time zone is correct, and whether the time of your server and the real time differs with over 3600 seconds. Ntpd would not sync if the difference was over an hour.

To query the current NTP servers, typ in at the CLI:

net time \\your-server-name /querysntp

You should get a list of addresses that w32time is using as a time source.

Advanced

More advanced settings can be done through the registry. This is especially useful if you want a time server (e.g. a PDC) that is correctly synced to an internet time server, and subsequently distributes that time over your network (i.e. Windows domain).

The following settings are all edited via the registry editor (regedit.exe).

Navigate to the key HKLM\SYSTEM\CurrentControlSet\Services\W32Time. This key contains all the settings for the time service. In that key, there are several subkeys and values, defining the settings of the service.

  1. Find the value HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\Type. By default it is set to NT5DS, which means time sync is done using Directory Services. Set this to NTP to enable time sync using the Network Time Protocol, the internet standard for time sync.
  2. Next up, find the key HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config\AnnounceFlags, and set its REG_DWORD from 10 to 5, marking this server as a reliable time source. This is required so clients can sync with the server's time. Note that this setting only works when the registry value at step 1 has been set to NTP.
  3. Next up, we need to set a list of time servers the server can sync from. This can be done by using the net time command line as documented early in this post, or by editing the registry value HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer. This registry key contains a space-delimited list of time servers, and can contain IP addresses or DNS names. Depending on which, you have to add a ,0x1 to enable name resolving on that entry.
    So, for example, if you want to sync the time to a random selected server from the european pool of open time servers, you can set this entry to 0.europe.pool.ntp.org,0x1. If you have a fixed time server you would like to use (e.g. the NTP server at USNO), set it to tock.usno.navy.mil,0x1 or as an IP, set it to 192.5.41.209, without the appendix ,0x1.

When these settings have been configured, don't forget to restart the time server:

net stop w32time
net start w32time

Note that it may take some time for the service to actually sync the time. If you don't want to wait for it, run this at the command line:

w32tm /resync /rediscover
Even more advanced

Adding to the advanced guide, there are some extra parameters you can specify to further tweak the time sync of your server or computer.

  • The REG_DWORD value HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval defines the polling interval in seconds of the NTP client to the upstream time servers. Set this to anywhere from 300 decimal to 3600 decimal. Microsoft recommends a default of 900 decimal.
  • The time correction settings are defined by two DWORD values: HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config\MaxPosPhaseCorrection and HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config\MaxNegPhaseCorrection. Its value expresses a value in seconds. Microsoft recommends a value of 3600 decimal or 1800 decimal, depending on the polling interval, internet connection and the used time servers.

Don't forget to restart w32time when adjusting any of these values.

 
 
« April 2024»
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    
 
Links
 
Quote
« Most people tend to avoid true conflict. Ironically this breeds more conflict. »