Microsoft

Win2K admins need to master the Time Service

Time synchronization across multiple machines on a network is always important. But in Windows 2000, proper synchronization is crucial in order for a number of services to work properly. This article shows you how to manage time in Win2K.


If you manage Windows 2000 and Active Directory, you should know that the Win2K Time Service is key to ensuring that the Kerberos security protocol and other Windows 2000 services work correctly. All machines in a Windows 2000 forest need to have the correct time. This article will explain the details and show you how to configure and troubleshoot the Time Service.

How does time synchronization work?
The Windows 2000 Time Service (w32time.dll) is installed by default on all Windows 2000 computers. The Time Service starts automatically on computers that are part of a domain and can be started manually on other machines.

When a computer joined to a domain is booted, the Time Service is enabled. As the Net Logon service looks for a domain controller (DC) and is authenticated, the computer sends a request to get the time and waits until the DC responds. Once it receives the time from the DC, the Time Service will perform the following:
  • If the local clock is behind the current DC time, the Time Service changes the local time immediately.
  • If the local clock is faster than three minutes, the Time Service changes the local time immediately.
  • If the local clock is less than three minutes fast, the Time Service slows the clock down to bring it into synchronization.

The Time Service then attempts synchronization every 45 minutes until all clocks are synchronized three times. Once properly synchronized, the Time Service will resynchronize time every eight hours. If you have Active Directory (AD) configured, all other machines in your forest will synchronize to your time server, as shown in Figure A.

Figure A
How time synchronization occurs


Before configuring the Time Service, you need to become familiar with some of the command-line tools you’ll use to work with it. We’ll start with the Net Time command.

Configuring Net Time
In order to properly configure Net Time, you need to know the syntax. If you open a command prompt and type net time /?, you’ll see the syntax shown in Figure B.

Figure B
The output of the net time/? command


Table A breaks down the list of options available for the Net Time command. You’ll use this command to have one of your domain controllers synchronize to an external authority and then provide time information to the rest of the domain.
Table A
Net Time options Description
Net Time Displays the time of your time server
Net Time \\computername Displays the computer name time
Net Time /DOMAIN:domainname Displays the time on a DC domain name
Net Time /domain/set Sets computer time to match time on Domain Controller
Net Time /RTSDOMAIN:domainname Displays the time on a time server in the domain name
Net Time /querysntp Displays the SNTP source for the time server
Net Time /setsntp:ntpserver Sets the SNTP source for the time server
Net Time /setsntp Clears the SNTP source for the time server
Net Time options

To display the time of a Windows 2000 machine, follow these steps:
  1. From the Start menu, select Programs | Accessories | Command Prompt.
  2. Type a command such as net time \\kiev, as we’ve done in Figure C.

Figure C
Display the time of a Windows 2000 machine.


To set the external Simple Network Time Protocol (SNTP) time server:
  1. From the Start menu, select Programs | Accessories | Command Prompt.
  2. Type a command such as net time /setsntp:ntp2.usno.navy.mil, as shown in Figure D.

Figure D
Set to synchronize with an external time server.


Here are the steps for querying the SNTP name:
  1. From the Start menu, select Programs | Accessories | Command Prompt.
  2. Type a command such as net time /querysntp, as shown in Figure E.

Figure E
Check the currently selected external time server.


Troubleshooting the Windows 2000 Time Service
The w32tm tool is used to troubleshoot any problems that might occur during or after the configuration of the Time Service. When troubleshooting, make sure to stop the Time Service before using this tool. Not doing so will cause a port error in the Event Viewer.

Furthermore, in order for the Time Service to work properly, you will need to have port 123 opened on your firewall. Otherwise, you can’t synchronize to an external time source. To access the syntax of the troubleshooting tool, type w32tm /? from a command prompt.

Table B shows a detailed list of command options available for the W32tm command.
Table B
W32TM parameter Description
-tz Print the local time zone information and exit
-s computer Force the given computer (or local computer if none is given) to resynchronize, then exit
-adj Set the computer's system clock frequency to the last frequency determined during synchronization, then exit
-adjoff Set the computer's system clock frequency to the system default, then exit
-source Choose a synchronization source, then exit. Note that a source is chosen before each synchronization, so this is useful only in showing that a source could be found. Remember to use -v to see the output.
-once Do only one synchronization, then exit. Otherwise, run continuously as a client, synchronizing the local clock until ctrl-c is pressed.
The following options can be used in conjunction with the above:
-test Prevent the time on the local system from actually being modified
-v Print out a verbose description of what the program is doing. This is usually needed since otherwise the program produces no output. The exceptions are -s and -tz.
-p -P <port> set the server port
-period

<Freq> set the sync period just as in the registry. That is:
0=once a day
65535=once every 2 days
65534=once every 3 days
65533=once every week (7 days)
65532=once every 45 min (3/day)
65531=once every 45 min until we get one good sync, then once every day

W32tm command options

To test the synchronization of a computer:

From the Start menu, select Programs | Accessories | Command Prompt.
  1. Type net stop w32time.
  2. Type w32tm –once –test –v (Figure F).

Figure F
The results of a synchronization test


Author’s Note
You will have to stop and start the service every time you make a change to the Time Service. You must have Administrator rights to stop and start services. To stop the W32 Time Service:
  1. From the Start menu, select Programs | Accessories | Command Prompt.
  2. Type net stop w32time.
To start the W32 Time Service:
  1. From the Start menu, select Programs | Accessories | Command Prompt.
  2. Type net start w32time.
To stop and start the service using the Windows 2000 graphical user interface (GUI):
  1. From the Start menu, select Programs | Administrative Tools | Computer Management.
  2. Select Services And Applications.
  3. Select Services and highlight Windows Time.
  4. Right-click to stop or start the service.


Conclusion
We have provided you with a brief look at the Windows 2000 Time Service. For more information, you can also reference the following resources:

Do you have tips for working with the Win2K Time Service?
How do you synchronize time on your network? We look forward to getting your input and hearing about your experiences regarding this topic. Join the discussion below or send the editor an e-mail.

 

Editor's Picks