Synchronizing hosts through NTP


Note: XNTP has been superseded by NTP.

Setting up NTP on the Linux server

rpm -Uvh ntp-4.0.99j-7.i386.rpm 

Edit /etc/ntp.conf
#server     # local clock
#fudge stratum 10
If the local time is too out-of-sync from UTC, run date "MMDDhhssYYYY" before launching NTP (see below)

Setting the BIOS/CMOS/hardware clock

hwclock --set --date="9/22/96 16:45:05"

Setting the software clock

date "110616252000" (ie. Nov 16th 2000, 16h25)
- OR -
hwclock --hctosys (to have it read the BIOS date and set it as the system clock)
Note: To set the BIOS clock from the system clock, run hwclock --systohc

Setting up NTP on Windows hosts

Besides the TimeServer utility available from the NT Resource Kit which can be installed as a service, hosts can be synchronized against your NTP Linux server through either the DOS command line "net time \\LINUX /set" (great thing to add to users' login script), or utilities such as NetTime.

NTP sharewares are numerous. Among others are K9 and Tardis.

(From MS' website)

The files you'll want to copy from the Supplement 4 Resource Kit CD are found in the \i386\compmgmt directory. Copy the Timeserv.ini file into your WINNT directory (the directory where your Windows NT files are located), and copy the Timeserv.exe and Timeserv.dll files into the \winnt\system32 directory. Next, make the desired changes to the Timeserv.ini file. For the purposes of this article, I'll assume that you will only be activating the NTP portions of the Timeserv service. Using either the MS-DOS® edit command or Notepad, open the Timeserv.ini file. Look for the [Timeserv] section of the INI file. Insert a semicolon in front of the Type=NISTACTS statement and remove the semicolon from the Type=NTP statement.

You will insert either the IP address or full DNS time (i.e. in the "NTPServer=" line in the Timeserv.ini file. The Timeserv service has a limitation of looking at only one NTP server. If you enter the IP address or DNS names of multiple NTP systems separated by spaces, commas, or semicolons, you'll receive an error when you start the time service. Insert a semicolon in front of the line that begins with timesource=no. The next line should read timesouce=yes—remove the semicolon from the beginning of the line. This command initiates a change in the Windows NT registry that will advise other servers in the network that this system can serve as a time source with authority.

The most important command to change in this section is Log=no. As before, insert a semicolon in front of this command, and remove the semicolon that's at the beginning of the following line, which should read Log=yes. This command allows entries to be made to the application log in Event Viewer. Unlike most Windows NT programs, Timeserv doesn't have a visual interface. To ensure that everything's working properly, you should make sure you log time events. Next, open MS-DOS and change directories to \WINNT\SYSTEM32. Type timeserv –automatic and press [Enter]. Double-click Services in the Control Panel and Time Service appears in the list of services. By default, Time Service will automatically start the next time you restart the PC. Unlike other Windows NT programs and services, you have the option of starting Time Service now without shutting down and restarting the Windows NT workstation. Give the time service a couple of minutes, then check the application in the event viewer. You should see a message indicating that there was a time variance of more than one-half of a second.

Periodically check that the time service is still successfully setting the time on your server. If you need to change to a different NTP server, stop Time Service Services icon in Control Panel before making any changes. Make the necessary changes to Timeserv.ini using an editing program (such as Notepad), then save the file in text format (TXT). Change to the \WINNT\System32 directory, type timeserv –update and press [Enter]. Now you can click the Services icon in the Control Panel and restart Time Service.

Keeping the servers on your network running on or near the same time is very important. When you have multiple servers, using Time Service helps keep the entries in the event viewer logs as close to the same time as the other servers as possible. Although the amount of visual feedback as to how well it's working is limited, the Time Service available in the Windows NT Server Resource Kit offers a functional time service without having to purchase a third-party solution to keep your servers synchronized.

P Version 4 distribution includes, in addition to the daemon itself (ntpd), several utility programs, including two remote-monitoring programs (ntpq, ntpdc), a remote clock-setting program similar to the Unix rdate program (ntpdate), a traceback utility u seful to discover suitable synchronization sources (ntptrace), and various programs used to configure the local platform and calibrate the intrinsic errors.


Temp stuff

2.3. Is UTC the same as GMT? The observatory in Greenwich derived GMT from astronomical
events like the solar day.  UTC is based on a quantum resonance of a cesium
atom, being quite more accurate.

4.1.2. What is SNTP? SNTP (Simple Network Time Protocol) is basically also NTP, but lacks some internal algorithms that are not needed
for all types of servers.  See Q: 9.3. for more and detailed information.

A daemon process that is both, client and server.

A utility to set the time once, similar to the popular rdate command. ntpdate sets the system clock once and mostly in a brute way. Basically can run ntpdate in a cron job hourly or daily, but your machine won't be an NTP server then. In contrast, running xntpd will learn and remember the clock drift and it will correct it autonomously, even if there is no reachable server.  Therefore large clock steps can be avoided while the machine is synchronized to some reference clock.  In addition xntpd will maintain error estimates and statistics, and finally it can offer NTP service for other machines.  Last, but no least, ntpdate cannot query a local reference clock. In addition, there are plans to put the functionality of ntpdate into ntpd. 

ntpq, ntpdc
Monitoring and control programs that communicate via UDP with ntpd.

A utility to back-trace the current system time, starting from the local server.

 Peregrine Systems - Knowledge BaseTitle 	setting NTP on AGDS network

Description ((To attach files, choose File | Attach):

computer CLOCK(srv2) & CLOCK2(mail) have been set up as NTP server.

#/etc/ntp.conf config file for clock
server #
server #
server #
server prgngw
peer clock2
server # local clock in case of disaster
fudge stratum 10 # show poor stratum
driftfile /etc/ntp/drift
authenticate no
keys /etc/ntp/keys
logfile /var/log/ntp
logconfig =all

and the same for clock2 changing  by 

on clock & clock2

on the NTP client side:
#/etc/ntp.conf config file for clock
server clock
server clock2
server # local clock in case of disaster
fudge stratum 10 # show poor stratum
driftfile /etc/ntp/drift
authenticate no
keys /etc/ntp/keys
logfile /var/log/ntp
logconfig =all

add 2 links S20ntpd and K20ntpd in /etc/rc.d/rc3.d to /etc/rc.d/init.d/ntpd

Windows client
On NT4, TIMESERV is a time service offered with the Resource Kit. Use the z:\backup\jfa\time.bat to set the NTP service on your computer.
Listing of z:\backup\jfa\time.bat:

copy z:\app\win\ResKit\TIMESERV.EXE %SystemRoot%\system32
copy z:\app\win\ResKit\TIMESERV.DLL %SystemRoot%\system32
copy z:\tmp\jfa\TIMESERV.INI %SystemRoot%
%SystemRoot%\system32\TIMESERV -AUTOMATIC
net start timeserv

Windows2000: ? (need more info on W2K's default time service)  

2000-03-10 JA: Extract from a 'tip of the day' list:
One of the Windows NT Resource Kit utilities, TimeServ, enables you
to configure your Windows NT-based computers (running Windows NT
version 3.5 or later) to synchronize their clocks either by modem
or over the Internet. TimeServ enables you to configure a computer
to synchronize its clock with a number of different time sources
including the National Institute of Standards and Technology's
Atomic Clock. Before you use this utility, make sure you download
the latest version of it from

Microsoft has documented a bug with the version of timeserv.exe
that originally shipped in the Windows NT Resource Kit.

You should configure one computer on your network to act as a primary
time server by having it synchronize its clock with an official time
server. You can then configure all of the other computers to set their
time via your primary time server. To install TimeServ on your primary
time server, log on as a user with administrative privileges and copy
timeserv.exe and timeserv.dll to your server's \%SystemRoot%\System32
folder. (For example, if you installed Windows NT Server to C:\WINNT,
you should copy these two files to C:\WINNT\SYSTEM32.) Next, Copy the
file named timeserv.ini to \%SystemRoot%. Finally, start TimeServ by
running either timeserv - automatic or timeserv - manual from the
command prompt. (If you use the automatic parameter, Windows NT will
automatically restart the service whenever you reboot your server.
If you use the manual parameter, you must manually restart the
TimeServ service yourself.)

Note: By default, the timeserv.ini file configures your computer to
dial the United States "atomic clock." In addition, it assumes that
your computer is using a standard modem on COM1 and doesn't dial a
PBX prefix (such as 9). If you want to configure your computer to
use different settings, you'll need to edit the timeserv.ini file
to reflect those settings. You'll find detailed instructions on
how to edit the timeserv.ini file in the TimeServ documentation
(TimeServ.htm) included with the Resource Kit.

Once you have configured a primary time server to set its time by
the Atomic Clock, you can configure your other Windows NT-based
computers to set their clocks by the primary time server by using
the net time command or by installing TimeServ as a service on
their computers. If you use the net time command, you'll need to
permit Domain Users to change the date/time on those computers by
modifying User Rights in User Manager for Domains. If you use
TimeServ to set their clocks, you'll need to edit the timeserv.ini
file to indicate that the client obtains its time from your primary
time server.