Network Time Protocol, Time Servers and Sychronised Time
NTP is widely used to synchronise the time on computers on the internet. NTP provides the ability to access time services, organise the time synchronisation subnet and adjust the local clock in each participating subnet computer. Typically, NTP provides accuracies of between 1 and 50 milliseconds depending on the time source and network paths.
Network Time Protocol can be utilised to synchronise the time on computers across a network. A time server is utilised to obtain the correct time from a time source and adjust the local time in each participating computer.
The time source used by the NTP time server is extremely important as this forms the basis of all time updates across the network. Recent studies show an alarming number of stratum 1 time sources on the internet are bad time keepers. A reported 391 of 957 supposedly stratum 1 NTP time sources had time offsets of over 10 seconds. Incredibly, one time source was offset by a staggering 6 years. Only 28% of the internet based stratum 1 clocks actually appears to be useful, based on research by Nelson Minar, MIT Media Lab Cambridge, MA USA.
What is NTP?
NTP stands for Network Time Protocol, and it is an Internet protocol used to synchronise the clocks of computers to some time reference. NTP is an Internet standard protocol originally developed by Professor David L. Millsat the University of Delaware.
What is SNTP?
SNTP (Simple Network Time Protocol) is basically NTP, but lacks some internal algorithms that are not needed for all types of servers.
Why Should Computer Time be synchronised?
Time usually just advances uniformly. However, if you have communicating programs running on different computers, time should uniformly advance if you switch from one computer to another. Obviously, if one system is ahead of the others, the others are behind that particular one. Switching between these systems would cause time to jump forward and back, producing an undesirable effect.
Isolated networks may run their own incorrect time, but as soon as you connect to the Internet, effects will be visible. Just imagine some e-mail message arriving five minutes before it was sent.
Even on a single computer some applications have trouble when the time jumps backwards. For example, database systems using transactions and crash recovery like to know the time of the last good state.
What are the basic features of NTP?
- NTP needs a reference clock that defines the true time. All clocks are set towards that true time. (It will not just make all systems agree on some time, but will make them agree upon the true time as defined by some standard.)
- NTP uses UTC as reference time.
- NTP is a fault-tolerant protocol that will automatically select the best of several available time sources to synchronise to. Multiple candidates can be combined to minimize the accumulated error. Temporarily or permanently insane time sources will be detected and avoided.
- NTP is highly scalable: A synchronization network may consist of several reference clocks. Each node of such a network can exchange time information either bi-directional or unidirectional. Propagating time from one node to another form a hierarchical graph with reference clocks at the top.
- Having available several time sources, NTP can select the best candidates to build its estimate of the current time. The protocol is highly accurate, using a resolution of less than a nanosecond (about 2^-32 seconds).
- Even when a network connection is temporarily unavailable, NTP can use measurements from the past to estimate current time and error.
- For formal reasons NTP will also maintain estimates for the accuracy of the local time
Which Operating Systems are supported?
NTP is readily available for most popular UNIX operating systems. Among these are: AIX, HP-UX, Irix, Linux, SCO UNIX, OSF/1, Solaris, System V.4.
There's also a supported implementation for VMS: "UCX (the VMS TCP stack) has a full implementation of NTP built-in. As of v5 it's pretty much vanilla NTP, prior to that the command syntax and control file formats were proprietary."
If you are worried with compatibility issues, older version clients can generally talk to newer version servers automatically, but the other direction requires manual interference.
NTP 4.2. History
The first NTP implementation started around 1980 with an accuracy of only several hundred milliseconds. That very first implementation was documented in Internet Engineering Note [IEN-173]. Later the first specification appeared in [RFC 778], but it was still named Internet Clock Service. At that time clock synchronization was needed for the HELLO routing protocol. NTP was introduced in [RFC 958] for the first time, mainly describing the packets seen on the network as well as some basic calculations involved. Early versions of NTP did not compensate any frequency error.
The first complete specification of the protocol and accompanying algorithms for NTP version 1 appeared 1988 in [RFC 1059]. That version already had symmetric operation mode as well as client-server mode.
Version 2 introducing symmetric-key authentication (using DES-CBC) was described in [RFC 1119] only about one year later. About the same time another time synchronization protocol named Digital Time Synchronization Service (DTSS) was presented by Digital Equipment Corporation. At that time the software named xntp was written by Dennis Fergusson at the University of Toronto. That software evolved to the software distribution that is publicly available now.
Combining the good ideas of DTSS with those of NTP produced a new specification for NTP version 3, namely [RFC 1305], in 1992. That version introduced formal correctness principles and revised algorithms. Furthermore broadcast mode was added to the protocol.
While NTP per se only deals with adjusting the operating system's clock, there was some parallel research on improving time keeping within the operating system's kernel. [RFC 1589] (A kernel model for precision timekeeping) described a new implementation and interface in 1994. That implementation could keep time with a precision of up to one microsecond.
While version 3 was still the latest specification available, both, the specification and the implementation has been continuously improved (this is what xntp3-5 actually implements). Since about 1994 work for a new version of NTP is in progress. The first new specification was [RFC 2030], Simple Network Time Protocol (SNTP) version 4 for IPv4, IPv6 and OSI.
External pulses can be used to calibrate and stabilize the operating system's clock. Therefore an operating system interface (API) has been designed and documented in [RFC 2783] (Pulse-per-second API for Unix-like operating systems, version 1), finally published in 1999.
The next version of NTP will provide new features regarding automatic configuration (e.g. manycast mode), reliability, Internet traffic reduction, and authentication (using public-key cryptography). A new kernel clock model can keep time with a precision of up to one nanosecond.
Which Implementations are available for UNIX?
Fortunately there is an implementation of an NTP client and server available for free. The software is available as C source and it runs on most UNIX compatible operating systems. The software consists of the following components:
- A daemon process that is both, client and server.
- A utility to set the time once, similar to the popular rdate command.
- 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.
- documentation in HTML.
- The documentation for the software is definitely worth reading.
- There are also several scripts that might be useful or at least a source of ideas if you want to run and monitor NTP.
Windows/2000 includes a built-in SNTP client. Follow this procedure:
- Select a NTP server, using net time /setsntp:ntp-server. However, only the domain controller that holds the PDC FSMO (Primary Domain Controller Flexible Single Master Operation) role can query an external time source to set the time.
- Start the W32Time service with net start W32Time. You can also set the start option of the Windows Time Synchronization Service W32Time to automatic, so the service will start when Windows/2000/2003 starts.
NTP is a protocol designed to synchronise the clocks of computers over a network. NTP version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a significant revision of the NTP standard, and is the current development version, but has not been formaliz ed in an RFC. Simple NTP (SNTP) version 4 is described in RFC 2030.
New NTP users should read the Where-To-Start file includ ed with the NTP distribution. Additional information is available on the documentation page. If you would like to find a server to get time from, please see the public NTP server list. If you would like to locate NTP software other than the reference distribution, please see the links page.
A list of NTP servers and reference clocks, ntp documentation, time and frequency standard stations, and time and frequency standard station transmission data is maintain ed at the Information on Time and Frequency Services page. Background information about NTP, along with briefings and a bibliography, are available at the Network Time Synchronization Project page.
To contact the NTP web maintainer or any of the NTP developer team, please see the contact page. Please direct comments and questions about the web site to the webmaster.
Extracts Taken from the home of NTP www.ntp.org, home of the Network Time Protocol (NTP) project.