Archive for September, 2008

What is a NTP server?

A NTP server is really just a time server that utilises Network Time Protocol (NTP). Whilst other time protocols do exist, NTP is by far the most commonly used and is utilised in over ninety percent of time servers.

NTP server and time server are therefore interchangeable terms but describe the same thing: a device used to receive and distribute a timing signal.

The timing signal utilised by most NTP servers is a UTC time source. UTC (Coordinated Universal Time) is a global time scale based on the time told by atomic clocks. By utilising UTC a NTP server can in affect, synchronise a network to the same time as millions of other computer networks from around the world. This has made possible many online global transactions that just simply wouldn’t be possible without UTC.

The timing signal is received by the NTP server (or time server) via a number of ways; the Internet, national time and frequency transmission (long wave) or the GPS (global positioning system) network. Once received the time server (NTP server) checks the authenticity of this signal (except from Internet sources where authentication is not possible), evaluates its accuracy then distributes it amongst the network.

To prevent a possible overload of time requests to the time server, machines that receive a time signal from the NTP server, can themselves be used as a time reference and the machines that receive a time signal from those can again be used as a reference. This hierarchy is called stratum levels. A NTP server is a stratum 1 device, a machine that receives a signal directly from the time server is a stratum 2 device and if a machine receives a signal from that it becomes stratum 3.

Advertisements

NTP server – GPS or radio?

The NTP server is an essential network tool. Whilst other protocols do exist, NTP is by far the standard time synchronisation protocol and is utilised in the majority of time servers.

A NTP server is reliant on a single time source it is this time reference that it uses to distribute amongst the network and synchronise to. This timing reference tends to be a UTC time source (coordinated universal time) which is a global time source based on the time told by atomic clocks.

There are only two viable options for receiving a UTC timing source. Although the Internet can be used, the signal can’t be authenticated this is a security measure used by NTP to ensure the reference is what it says it is. Also by using an Internet time source a hole must be left open in the network firewall to allow for communication to the server, this has its own security risks.

The only two secure methods for receiving a UTC time signal is to either use the GPS network or national time and frequency transmissions that are broadcast by several countries’ national physics laboratories.

In selecting a timing source for a NTP server, location is the key consideration. The national time and frequency transmissions are not available in every country. Whilst the USA, UK, Germany, France, Japan and Finland have a signal there are many countries that do not. Furthermore being a long wave radio transmission it can easily be blocked by local topography, although the radio aerial can pick op a signal indoors which is something a GPS NTP server can’t do.

GPS antennas have to be situated on a roof. This can have logistical problems if the server room is in the basement of a high storey building but on the plus inside the GPS signal can be received literally anywhere in the world.

NTP Server – Stratum Levels Explained

Network Time Protocol is a hierarchical protocol and is divided into stratum which define the distance from the reference clock. A reference clock source that relays UTC (Coordinated Universal Time) time and has little or no delay is known as a stratum-0 device. Stratum-0 servers cannot be used on the network, instead, they are directly connected to computers which then operate as primary time servers.

A primary server that receives a time signal from a stratum 0 device either through the GPS network or national time and frequency transmission is known as a stratum-1 device. On a network a stratum 1 time server supplies the time to other devices on the network which are known as stratum-2 devices. These also can be used as a time source and equipment that connects to a stratum-2 device to receive it become stratum-3 and so on.

NTP can handle up to 16 different stratum levels, although the lower down the hierarchy you go the less accurate the devices become. However, to make the system more reliable, each client can receive a time source from multiple servers. Stratum 2 devices and below can also synchronise with each other. The NTP software monitors continuously the figures of stability and accuracy of all the servers and always chooses a server with the best figures.

Multiple stratum are used an in larger networks because to bombard a single stratum-1 time server with NTP requests from thousands of machines could cause it to overload or block the network itself with workstations/routers etc repeatedly waiting for their time synchronisation requests to go through.

An example of a typical NTP network   (Image courtesy of Wikipedia)

Stratum 1 time servers connected to a stratum 0 source, stratum 2 servers connected to stratum 1 and stratum 3 connected to stratum 2.

Stratum 1 time servers connected to a stratum 0 source, stratum 2 servers connected to stratum 1 and stratum 3 connected to stratum 2.

NTP server – Introduction to Network Time Protocol.

Network Time Protocol (NTP) is one of the Internet’s oldest protocols still in use. Developed by Dr David Mills from the University of Delaware, it has been in constant use and continually updated since 1985. NTP is a protocol designed to synchronize the clocks on computers and networks across the Internet or Local or Wider Area Networks (LANs/WANS).

In a modern global economy time synchronisation is essential for carrying out time sensitive transactions such as booking an airline ticket to bidding on an Internet auction site. If clocks were not synchronised to the same time you may find your airline seat sold after you had bought it and Ebay’s administrators would not be able to discover whose bid was the latest.

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.

NTP uses an algorithm (Marzullo’s algorithm) to synchronise time on a network using time scales like UTC (Coordinated Universal Time or Temps Universel Coordonné) and can support such features as leap seconds – added to compensate for the slowing of the Earth’s rotation.

NTP (version 4 being the latest) can maintain time over the public Internet to within 10 milliseconds (1/100th of a second) and can perform even better over LANs with accuracies of 200 microseconds (1/5000th of a second) under ideal conditions.

NTP time servers work within the TCP/IP suite and rely on UDP (User Datagram Protocol). A less complex form of NTP called Simple Network Time Protocol (SNTP) that does not require the storing of information about previous communications, needed by NTP, is used in some devices and applications where high accuracy timing is not as important and is also included as standard in Windows software (although more recent versions of Microsoft Windows have the full NTP installed and the source code is free and readily available on the Internet).

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.

Synchronisation with NTP is relatively simple, it synchronises time with reference to a reliable clock source such as an atomic clock, although these are extremely expensive and are generally only to be found in large-scale physics laboratories, however NTP can use either the Global Positioning system (GPS) network or specialist radio transmission to receive UTC time from these clocks.

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).