NTP, or Network Time Protocol, is a standard Internet protocol for disseminating accurate time accross a computer network. The protocol is used to synchronize network infrastructure and time critical applications. This article introduces NTP and provides an overview of how NTP servers utilise the Network Time Protocol to provide a precise time reference to network time clients.

NTP is one of the oldest Internet protocols that is still widely used today. It has been used continuously for over 25 years. The protocol was originally developed to synchronize time critical processes over the Internet. Originally developed for Linux, it has since been ported to the Microsoft Windows operating systems. Often, the NTP software distribution is installed by default in many corporate Linux /Unix and Free BSD distributions. Dedicated NTP servers tend to utilise NTP on the Linux operating system due to its specialised kernel timing algorithms and low implementation costs.

NTP has a hierarchical structure. A primary reference server sits at the highest level. Lower level servers in the hierarchy obtain time from the level above, thus forming a reverse tree-like structure. A primary reference server is synchronised by an external timing reference, such as a GPS hardware clock. At the highest level a primary reference server has a stratum of one. Each lower-level server and client is attributed a stratum one greater than the previous level. As the stratum increases, accuracy decreases due to inconsistencies in network path timing.

In normal operation, the protocol is a client-server based, although it can operate in a broadcast fashion. Generally, clients ask for time from the server and the server responds with a time stamp. Essentially, the server provides the client with three products: system ‘clock offset’, ’round-trip delay’ and ‘dispersion’ of a specified reference clock. The ‘clock offset’ specifies the difference between the local system time and an external reference clock, such as GPS. ‘Round-trip delay’ measures the network round-trip delay experienced during the transfer of packets of information. ‘Time dispersion’ indicates the maximum error associated with received time stamps from the external reference clock.

NTP is based on the User Data-gram Protocol (UDP), part of the TCP/IP protocol suite. Each NTP message consists of a number of fields: Leap Indicator; Version Number; Mode; Stratum; Poll; Precision; Root Delay; Root Dispersion; Reference Identifier; Reference Timestamp; Originate Timestamp; Receive Timestamp; Transmit Timestamp; Key Identifier and Message Digest. The fields are used to identify messages and provide timing and network round-trip delay calculations.

The current release of NTP is version 4. All versions of the protocol are backwards compatible with previous versions. So, for instance, a version 3 client will happily sync to a version 4 server. Essentially, the only significant change to the protocol between versions 3 and 4 is a slight header modification to accommodate IPv6.

A primary reference NTP server has three modes of operation: unicast; anycast and multicast. The client initiates the unicast and anycast modes and the server responds with a time stamp that the client uses for synchronisation. In multicast and anycast modes, time stamps are broadcast throughout the sub-domain at periodic intervals.

The NTP distribution is freely downloadable from the NTP website under a GNU public licence. It can operate with a number of GPS and radio external hardware clock references, or ‘reference clocks’. GPS is a popular choice since it provides a highly accurate global source of time. A number of national time and frequency radio broadcasts are available, such as WWVB (US), DCF-77 (Germany) and MSF (UK), but these can only be received within a few thousand km of the transmitter.

SNTP, or Simple Network Time Protocol, is, as expected, a simplified version of NTP. SNTP is generally used where the complex synchronisation algorithms and high accuracy of NTP is not required. Often, small, less powerful, computers and micro-controllers with reduced processing power use SNTP rather than NTP to save on memory and processing overheads. However, SNTP and NTP are fully interchangeable. Any SNTP client can synchronise with a NTP server.

The author, Dave Evans is a technical author in the field of telecommunications and computer network time synchronisation. Click if you would like to read many other articles about NTP servers.

Category: Networks