Time Synchronization in an NT Network

Ensure that your time-sensitive systems and applications work correctly, by synchronizing your Windows NT network with a single, accurate, and standard time source.

Tao Zhou

January 31, 1997

13 Min Read
ITPro Today logo

Your network as clock-watcher

Network time synchronization is an important part of network design andimplementation. You need a time-synchronized network for healthy operation ofnetwork operating systems and applications; synchronization is critical forbusinesses that depend on a computer network. For example, many networkdirectory services systems exchange information and synchronize changes in thedirectory services database according to time stamps. Groupware applicationsrequire accurate time for scheduling and collaboration. Without atime-synchronized network, time-sensitive systems and applications will not workcorrectly. In a Windows NT network, all NT servers and client workstations needto synchronize with a single, accurate, and standard time source.

Although Microsoft doesn't supply a built-in time service in NT, the MicrosoftWindows NT Resource Kit CD-ROMs for NT 3.51 and 4.0 provide a TimeServutility. TimeServ is an NT service that can synchronize the system time with atime source either on the network or from outside. Microsoft also provides anetwork command, NET TIME, that synchronizes a computer on a Microsoft networkwith network time. This article introduces the two Microsoft timesynchronization utilities, outlines how to design a time-synchronized NTnetwork, and guides you in configuring and implementing time synchronization.

Windows NT Time Service
TimeServ works with NT Server and NT Workstation 3.5, 3.51, and 4.0. BecauseTimeServ is an NT service, it runs in the background even when no one is loggedon the system. TimeServ keeps an NT computer synchronized with standard timefrom a remote site or on the network. Components of time synchronization arestandard time sources, master time servers, primary time servers, and secondarytime servers.

A remote time service provider is a standard time source.Generally, it is a standard Greenwich Mean Time service provider, such as theNational Institute of Standards and Technology (NIST) in Boulder, Colorado, orthe US Naval Observatory (USNO) in Washington, D.C. You can obtain the standardtime using a modem or the Internet.

An NT server or workstation is called a master time server if itobtains standard time from a remote standard time source or from a network timeserver that supports Network Time Protocol (NTP) on IP. The master time serverthen provides this standard time to the rest of the network. At least one mastertime server must be on a time-synchronized network. For redundancy, two or moremaster time servers can be on the same network. However, Microsoft recommendsthat all master time servers use the same standard time source.

An NT server or workstation is a primary time server if it obtainsnetwork time from a specific NT time server on the network. This server isgenerally a master time server or an NT time server that provides good timeon the network. A server provides good time if its time drifts less than 0.5second from system time. The time service records time drift in the Applicationlog of the Events Viewer when the time service sets the system time to networktime. If the time drifts more than 0.5 second, the server may need to obtaintime more frequently. Any number of primary time servers can be on the network.

An NT server or workstation is a secondary time server if itobtains network time from a specific NT domain. This domain can be the samedomain in which the secondary time server resides, or a different domain, if notime server is in the same domain. Typically, you configure at least oneprimary time server to be the time source that answers time requests from thesecondary time server. In some cases, you can use a master time server or even asecondary time server as a time source, too, although a secondary time server isusually a client of a time source.

Multitiered Time Synchronization System
You can envision NT network time synchronization as a multitiered timesynchronization system. A master time server at the top of the system obtainsstandard time from a remote standard time source and then provides this time tothe entire network. Primary time servers in the middle of the system obtainnetwork time from a master time server and then give this time to secondary timeservers and client workstations. Secondary time servers and client workstationsreside at the bottom of the system and get network time from a primary timeserver. Secondary time servers and client workstations are network time clients.Figure 1 shows this multitiered time synchronization system.

Microsoft Network Time Command
Another way to synchronize time on a network is with Microsoft's NET TIMEnetwork command. NET TIME is a DOS command for computers running NT, Windows 95,Windows for Workgroups, or DOS/Windows with Microsoft network client software.When you execute the NET TIME command, the workstation sets its system tonetwork time by searching for a time source in the domain. If a time source isnot present, the workstation will obtain time from a domain controller. For anNT computer, you can issue the command

NET TIME /DOMAIN: /SET /Y

to set the time to network time. For a non-NT computer, you can enter thecommand

NET TIME /WORKGROUP: /SET /Y

A computer can also synchronize its time with a specific computer if youenter the command

NET TIME \ /SET /Y

You must assign Change the system time to the user on theworkstation so that NET TIME can work.

NET TIME works well for workstations when you add it to an NT domain logonscript. When a workstation logs on to a domain, the workstation system time isset to the network time. TimeServ is a better utility for NT servers, because itruns in the background.

Designing a Time-Synchronized Network
Using these concepts, you can design your time-synchronized NT network.First, study the existing domain structure and physical layout of your networkwith these questions in mind: Where are the domains? Are they across a WAN link?How many servers are in a domain, and where are they? Which domains doworkstations belong to? Then choose a standard time source and define a mastertime server, primary time servers, and secondary time servers on the network.

TABLE 1: Standard Time Sources in TIMESERV.INI

Standard Time Source

Link

NISTACTS in Colorado (303-494- 4774)

Modem, Internet

USNO in Washington, D.C. (202- 653-0351)

Modem, Internet

NRC in Ottawa (613-745-3900)

Modem

BBC in UK (0891 516880)

Modem

Computime in Australia (61-03-9600-1641)

Modem

Sweden (0719-312-719)

Modem

Austria (43-316-472366)

Modem

Germany (49-531-512038)

Modem

Italy (166-11-46-15)

Modem

New Zealand (0900-45222)

Modem

Knowing your NT network structure is important when you design an optimaltime-synchronized network, because you want to balance the workload on existingand future servers and minimize the impact of time synchronization on networktraffic, especially in a WAN environment. A good rule is to keep timeacquisition as local as possible, both physically and logically. Physicallylocal means the time source or server is geographically near; logicallylocal means the time source or server is in the same domain or in one thatis close.

You can choose a standard time source based on your location or preference.Table 1 lists the standard time sources. In the US, TimeServ supports only NISTand USNO, even though they are not the only time sources. You can contact a timesource by modem, or if you have a stable Internet link, you can use it to savetelephone charges to a remote time source. If you have a good NTP server on thenetwork, your master time server can obtain network time from the NTP server ifyou specify NTP as the selected time source and give the NTP server name or IPaddress in the TimeServ initialization file.

For a small LAN without many servers and workstations in one NT domain, youmight not need a primary time server. All secondary time servers and clientworkstations can obtain network time from one master time source. Figure 2 showstime synchronization in a single-domain network.

For an NT network with multiple domains, the model is the multitiered timesynchronization system described earlier. A master time server can reside incorporate headquarters or the corporate MIS department for centralizedadministration. You can put one or more primary time servers in every domain.Adding this second layer of time servers reduces the workload of the master timeserver and reduces network traffic because only a limited number of primary timeservers talk to the centralized master time server, which might not be in theirlocal network. All remaining servers in every domain are secondary time serversthat obtain network time locally from a primary time server in the same domain.Figure 3 shows time synchronization in a multidomain network.

For a very large multidomain network, you can further reduce networktraffic if a primary time server in a domain requests the time from anotherprimary time server in a nearby domain. For example, a network has masterdomains in Chicago, New York, and London. Each master domain has regionalresource domains. A master time server is located in the corporate headquartersin Chicago. A primary time server is in each domain. To reduce traffic to themaster time server in the headquarters, you can design the primary time serverin a resource domain in Chicago, New York, and London to obtain time from theprimary time server in its regional master domain. Figure 4 illustrates thisprocess.

Configuring a Time Server
After you design the optimal time synchronization system for your network,you must configure each of your time servers by setting the configurationparameters in a TimeServ initialization file, timeserv.ini. Running the timeservice execution file, timeserv.exe, saves the settings to the system'sRegistry.

Listings 1, 2, and 3 show example configuration settings intimeserv.ini for a master time server using a modem, for a primary time server,and for a secondary time server, respectively. The settings answer the followingquestions:

1. What type is the time server?

The time server can be a master, primary, or secondary time server, as shownin the Type= statement in listings 1, 2, and 3. If a standard time source name,Internet, or NTP appears in the Type=statement, the server is amaster time server.

2. With what time source is the time server synchronized?

If the time server to be configured is a master time server, you must selectin timeserv.ini a standard time source such as NIST or USNO. If you use anInternet link to access NIST or USNO, you must check whether the source isblocked by a firewall. Try to PING tick.usno.navy.mil or Telnet132.163.135.130.13. One or both should respond if you have proper Internetaccess via TCP/IP. If you use a modem to dial the source, you must choose theCOM port of the modem, the modem speed, the modem command string, and thesource's telephone number. Callout A in Listing 1 shows the steps for calling atime source using a modem. If you use an NTP time server, you need to know itshost name or its IP address.

If the time server is a primary time server, you need to know the NTcomputer name of the master time server and of any other time servers. You enterthese names in a source list in timeserv.ini. You can randomly choose thetime server that the primary time server synchronizes with, or you can choose bytop-down order from the source list. The PrimarySource= statement at A inListing 2 illustrates the setting for a primary server to obtain the time from amaster time server. This primary server can get the time from a master server orfrom another primary server. The RandomPrimary= statement at C in Listing 2shows the setting for choosing a time source randomly from a source list ofservers.

If the time server is a secondary time server, you need to know whether itobtains time from the same domain or a different, secondary domain. TheSecondaryDomain= statement at A in Listing 3 shows a time source in a secondarydomain.

3. How often do you want the time server to request the time?

By default, a master time server using a modem requests time once a daybetween 6:00 am and 6:30 am (to get a low phone rate). A time server using anetwork link checks every 8 to 12 hours. You can easily change this setting tomany times daily by increasing the synchronization frequency in timeserv.ini.

For instance, if you want your time server to obtain time every hour, youcan set the configuration Period=24 in timeserv.ini. The Period= statement inlistings 1, 2, and 3 show example settings for synchronization frequency.

4. Is the time server a time source?

As defined earlier, a time source is a time server in a domain that respondsto time requests from a secondary time server or a client workstation searchingfor network time from the domain. Configure a primary time server as a timesource, as shown in the Timesource= statement at B in Listing 2. The servers inlistings 1 and 3 are not time sources.

5. Do you want to track time service events in the application log?

Even though the default is Off, turning the log on is a good idea, at leaston the master time server and the primary time servers. An On setting lets youtrack time service events in the application log of Events Viewer. With the logturned on, as it is in the Log= statement in all three listings, you can monitorwhether the time service is working as you want it to. Also, you can add thisevent to a monitoring system to automatically notify you of problems that arise.

6. Do you want the TimeAdjustment API to disable CMOS synchronization?

By default, NT regularly synchronizes the OS time to the CMOS Request toSend (RTS) when the OS time differs from the CMOS time by more than one minute.The result can be a maximum 0.45 second time drift daily if you use the defaultperiod (Period=0) in timeserv.ini. Usually, the clock in a time serverwill be more precise and stable when you disable the OS synchronization featureby using Tasync=no in timeserv.ini, because the NT time service obtains accuratenetwork time for the server. Leave the default as Tasync=no unless youfind time drifting more with timeserv than before. The last line in each listingshows the OS synchronization feature disabled. For more detailed information,read the Microsoft document timeserv.wri on the Microsoft Windows NTResource Kit CD-ROM.

Installation
Installing TimeServ is straightforward. Before you take the following stepsto install it on an NT machine, check timeserv.exe, timeserv.dll, andtimeserv.ini from the Microsoft Windows NT Resource Kit CD-ROMand verify that you have administrative privileges on the time server.

Copy files timeserv.exe and timeserv.dll to %systemroot%system32 inthe winnt directory, and copy file timeserv.ini to %systemroot%. Edit timeserv.ini for the time server as discussed in "Configuring a Time Server."

Run timeserv -automatic or timeserv -manual, depending on whetheryou want to start the time service automatically or manually the next time theserver starts. If the time server is a time source (i.e., Timesource=yes in timeserv.ini), reboot the server so that the time source takes effect. Otherwise,use the command NET START TIMESERV to start the time service, or start it in theServices utility in the Control Panel.

You sometimes need to modify timeserv.ini after the time service hasstarted. You must stop the time service, edit the file, execute timeserv-update, and restart the time service.

For a large network, Systems Management Server (SMS) lets you install thetime service for each time server using Microsoft SMS. If you do not have SMS,you can use NT Scheduler to install the time service on a remote time serverfrom your NT workstation. The Microsoft Windows NT Resource KitCD-ROM provides a Windows-based scheduler, WINAT.EXE. You will find using WINAT.EXE much easier than the command-line version AT.EXE. For workstations, youcan simply add your NET TIME commands to the domain logon script and synchronizeyour workstation to a domain or a computer, as described in "MicrosoftNetwork Time Command."

In Sync with Success
Microsoft's time service, TimeServ, and network time command, NET TIME, arevery useful for time synchronization in an NT network. Applying these two timeutilities to your NT network will keep your servers and workstationssynchronized to the standard time to enhance your success in systems managementand mission-critical business applications. Microsoft time utilities can scalefrom a small LAN with a single domain to a large WAN with multiple domainsacross time zones.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like