Network Time Protocol (NTP): The Way it Works

Jun 24
07:51

2008

Richard N Williams

Richard N Williams

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

This article explains how Network Time Protocol synchronises time on computer networks.

mediaimage

Network Time Protocol (NTP) is probably the Internet’s oldest protocol. Developed at the University of Delaware,Network Time Protocol (NTP): The Way it Works Articles it has been in use and continually updated for the last 25 years. In short it is a protocol designed to synchronize the clocks on computers and networks across the Internet or Local or Wider Area Networks (LANs/WANS).

NTP is a multi-tiered system, each tier being called a stratum. Servers at each tier communicate with each other (peer) and provide time to lower strata. Servers at the top stratum, stratum 1 connect to an atomic clock either over the Internet or by a radio or GPS receiver while a stratum 2 server will connect to a stratum 1.

The way NTP works is relatively straight forward. NTP timestamps relay the seconds from a set point in time (known as the prime epoch, usually set at 00:00 1 January 1900 or sometimes 00:00 1 January 1970) The NTP algorithm then determines the amount to advance or retreat the clock.

The NTP program (known as a daemon on UNIX and a service on Windows) runs in the background and refuses to believe the time it is told until several exchanges have taken place, each passing a set of tests. If the replies from a server satisfy these ‘protocol specifications’, the server is accepted. It usually takes about five good samples (five minutes) until a NTP server is accepted as a source for synchronisation.

NTP can synchronise time over the Internet but it should be noted that Microsoft and others recommend that external time references are used rather than Internet based ones as these can’t be authenticated.  External hardware sources use either a radio or GPS receiver to get a timing reference from an atomic clock.

NTP (currently up to version 4) can maintain time over the Internet to within 1/100th of a second (10 milliseconds () and can perform even better over Local Area Networks with accuracies of 1/5000th of a second  (200 microseconds) fairly common.

A simplified version of NTP called Simple Network Time Protocol (SNTP) exists that does not require the storing of information about previous communications as required by NTP. It is used in some devices and applications where high accuracy timing is not as important and is installed on older versions of Microsoft Windows. Windows since 2000 has included the Windows Time Service (w32time.exe) which uses SNTP to synchronise the computer clock. NTP is also available on UNIX and LINUX (download via NTP.org).