Andy's Unix FAQ

Unix Time / Clock synchronisation (synchronization)
See also: Example NTP Configuration files and script
  Functional rdate source for Linux and Solaris
  Looking for the rdate server ?


Unix FAQ Menu
Contents
Basic commands
Cron
Creating CDs
Device Files
DHCP server (Solaris)
Filesystem explained
Fsck
grub/lilo vanished!
Linux applications?
Linux databases?
Linux distributions
Serial Console
Solaris devices
Solaris disks - Intro
Solaris disks - Adding
Solaris x86 install
SQL/Shell script
Syslog/Monitoring
Time Synchronisation.
Virtual Memory
Web Multi-Language
Web Server Errors
Humour
Unix a Prank



 

Question;

Subject: Methods of synchronising two UNIX based systems

Question - Do you know what protocols can be used to synchronise two Unix based systems? Im aware of Network Transfer Protocol, are there others? what errors can be involved in the ntp approach. I would appreciate any knowledge you could share with me.

Answer;

Answer - I am only aware of NTP and the elderly UCB based 'rdate' protocol.

rdate is a simple one-shot approach: "rdate <hostname>" simply sets the clock of the local machine to that of the specific host. rdate is still part of Solaris, and is available for Linux. Depending on your needs rdate in a crontab (say once an hour) may suffice.

My preferred solution to this issue is NTP - Network Time Protocol. I routinely configure this on client's site whenever NFS, clustering or security sensitive systems are involved.

Contrary to popular belief NTP is usable on small, non-Internet connected sites, with or without an external time source. Such a configuration is referred to in NTP jargon as 'autonomous mode'.

The commonest error in this configuration is selecting a machine with an unreliable clock as a 'master'. I use the term 'master' hesitantly as there is no master in NTP, more correctly I should say 'higher level stratum" . When this happens NTP may flag the system as a 'false-ticker', which will eventually cause all systems to ignore it, and ultimately revert their own clocks to free-running mode. I.E. You are back to square one. This doesn't happen immediately - it can take days, even weeks to occur.

Another common error is failing to define a driftfile. This file retains a record of how far the local clock drifts from true time. It is used to preserve this value across NTP restarts, reboots, etc.

Ideally with NTP, one should have at least three local systems at a higher stratum ( 'master' clocks if you like ). In 'autonomous' configuration, the same is true but these machine would be the highest stratum on the network. BTW; In a production environment never have only two machines in the highest stratum.

That said, one of the best ways of determining the most reliable system clock on your network is to configure as many systems as you dare at the same stratum (choose a low number, say 5 to start with) and just point them all at each other ("server" directive). Watch them all over a period of days, and see which clock they all lock onto. Thus you have your best clock..

Also on this website - Example client/server configuration and a sample setup script.

URL for main NTP Website is; http://www.ntp.org/
  

Looking for the rdate server ?
Briefly don't bother, you probably won't find one.
The rdate protocol is implemented via the tcp/udp service time on port #37. The service is so trivial that the server side of it is usually implemented within the inetd daemon. Check your inetd.conf file, if you see 'internal' with the time service then your inetd daemon answers the rdate query.

Extract from a Solaris inetd.conf;

      time stream tcp nowait root internal
time dgram udp wait root internal

Feedback

I hope you found this FAQ to be of some use. It would be most helpful if you could rate it below. All fields are optional...
Please do not use this form to seek free technical assistance - Try AllExperts...

Excellent Your Email:
Good Comments or Suggestions
Useful
Slightly useful
Not useful
        

 



Home Thai Guide   Great Circle Calculator WorldClock AMS Services Contact us