Network Time Protocol
Encyclopedia
The Network Time Protocol (NTP) is a protocol and software implementation for synchronizing the clocks
Clock synchronization
Clock synchronization is a problem from computer science and engineering which deals with the idea that internal clocks of several computers may differ. Even when initially set accurately, real clocks will differ after some amount of time due to clock drift, caused by clocks counting time at...

 of computer systems over packet-switched, variable-latency
Latency (engineering)
Latency is a measure of time delay experienced in a system, the precise definition of which depends on the system and the time being measured. Latencies may have different meaning in different contexts.-Packet-switched networks:...

 data networks. Originally designed by David L. Mills
David L. Mills
David L. Mills is an American computer engineer and Internet pioneer. Mills earned his PhD in Computer and Communication Sciences from the University of Michigan in 1971...

 of the University of Delaware
University of Delaware
The university is organized into seven colleges:* College of Agriculture and Natural Resources* College of Arts and Sciences* Alfred Lerner College of Business and Economics* College of Earth, Ocean and Environment* College of Education and Human Development...

 and still maintained by him and a team of volunteers, it was first used before 1985 and is one of the oldest Internet protocol
Internet protocol suite
The Internet protocol suite is the set of communications protocols used for the Internet and other similar networks. It is commonly known as TCP/IP from its most important protocols: Transmission Control Protocol and Internet Protocol , which were the first networking protocols defined in this...

s.

NTP is not related to the simpler Daytime Protocol or the Time Protocol
TIME protocol
The Time Protocol is a network protocol in the Internet Protocol Suite defined in 1983 in RFC 868. Its purpose is to provide a site-independent, machine readable date and time....

.

Overview

NTP provides Coordinated Universal Time (UTC)
Coordinated Universal Time
Coordinated Universal Time is the primary time standard by which the world regulates clocks and time. It is one of several closely related successors to Greenwich Mean Time. Computer servers, online services and other entities that rely on having a universally accepted time use UTC for that purpose...

 including scheduled leap second
Leap second
A leap second is a positive or negative one-second adjustment to the Coordinated Universal Time time scale that keeps it close to mean solar time. UTC, which is used as the basis for official time-of-day radio broadcasts for civil time, is maintained using extremely precise atomic clocks...

 adjustments. No information about time zone
Time zone
A time zone is a region on Earth that has a uniform standard time for legal, commercial, and social purposes. In order for the same clock time to always correspond to the same portion of the day as the Earth rotates , different places on the Earth need to have different clock times...

s or daylight saving time
Daylight saving time
Daylight saving time —also summer time in several countries including in British English and European official terminology —is the practice of temporarily advancing clocks during the summertime so that afternoons have more daylight and mornings have less...

 is transmitted; this information is outside its scope and must be obtained separately.

NTP uses Marzullo's algorithm
Marzullo's algorithm
Marzullo's algorithm, invented by Keith Marzullo for his Ph.D. dissertation in 1984, is an agreement algorithm used to select sources for estimating accurate time from a number of noisy time sources...

 and is designed to resist the effects of variable latency. NTP can usually maintain time to within tens of milliseconds over the public Internet
Internet
The Internet is a global system of interconnected computer networks that use the standard Internet protocol suite to serve billions of users worldwide...

, and can achieve 1 millisecond accuracy in local area network
Local area network
A local area network is a computer network that interconnects computers in a limited area such as a home, school, computer laboratory, or office building...

s under ideal conditions.

, the current reference implementation is version 4 (NTPv4), which is a proposed standard as documented in RFC 5905.

The protocol uses the User Datagram Protocol
User Datagram Protocol
The User Datagram Protocol is one of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer applications can send messages, in this case referred to as datagrams, to other hosts on an Internet Protocol network without requiring...

 (UDP) on port number 123.

A less complex implementation of NTP, using the same protocol but without requiring the storage of state
State (computer science)
In computer science and automata theory, a state is a unique configuration of information in a program or machine. It is a concept that occasionally extends into some forms of systems programming such as lexers and parsers....

 over extended periods of time, is known as the Simple Network Time Protocol (SNTP). It is used in some embedded devices and in applications where high accuracy timing is not required (RFC 1361, RFC 1769, RFC 2030, RFC 4330 and RFC 5905).

Unix

For modern Unix systems, the NTP client is implemented as a daemon
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

 process that runs continuously in user space
User space
A conventional computer operating system usually segregates virtual memory into kernel space and user space. Kernel space is strictly reserved for running the kernel, kernel extensions, and most device drivers...

 (ntpd
Ntpd
The Network Time Protocol daemon is an operating system daemon program that maintains the system time in synchronization with time servers using the Network Time Protocol .-Description:...

). Because of sensitivity to timing, however, it is important to have the standard NTP clock phase-locked loop
Phase-locked loop
A phase-locked loop or phase lock loop is a control system that generates an output signal whose phase is related to the phase of an input "reference" signal. It is an electronic circuit consisting of a variable frequency oscillator and a phase detector...

 implemented in kernel space
User space
A conventional computer operating system usually segregates virtual memory into kernel space and user space. Kernel space is strictly reserved for running the kernel, kernel extensions, and most device drivers...

. All recent versions of Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, BSD, Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

, Solaris and AIX
AIX operating system
AIX AIX AIX (Advanced Interactive eXecutive, pronounced "a i ex" is a series of proprietary Unix operating systems developed and sold by IBM for several of its computer platforms...

 are implemented in this manner.

The NTP packet is a UDP datagram, carried on port 123.

Microsoft Windows

All Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 versions since Windows 2000 include the Windows Time Service, which has the ability to sync the computer clock to an NTP server. However, the version in Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...

 only implements Simple NTP, and violates several aspects of the NTP version 3 standard. Beginning with Windows Server 2003
Windows Server 2003
Windows Server 2003 is a server operating system produced by Microsoft, introduced on 24 April 2003. An updated version, Windows Server 2003 R2, was released to manufacturing on 6 December 2005...

, the Microsoft documentation states: "Although the Windows Time service is not an exact implementation of the Network Time Protocol (NTP), it uses the complex suite of algorithms that is defined in the NTP specifications to ensure that clocks on computers throughout a network are as accurate as possible."

However, the Windows Time Service cannot maintain the system time more accurately than about a 1-2 second range. Microsoft "[does] not guarantee and [does] not support the accuracy of the W32Time service between nodes on a network. The W32Time service is not a full-featured NTP solution that meets time-sensitive application needs. The W32Time service is primarily designed to do the following:
  • Make the Kerberos version 5 authentication protocol work.
  • Provide loose sync time for client computers."


The reference implementation of NTP can be used on Microsoft Windows NT 4.0 systems.

Clock strata

NTP uses a hierarchical, semi-layered system of levels of clock sources. Each level of this hierarchy is termed a stratum and is assigned a layer number starting with 0 (zero) at the top. The stratum level defines its distance from the reference clock and exists to prevent cyclical dependencies in the hierarchy. It is important to note that the stratum is not an indication of quality or reliability, it is common to find stratum 3 time sources that are higher quality than other stratum 2 time sources. This definition of stratum is also different from the notion of clock strata
Synchronization in telecommunications
Many services running on modern digital telecommunications networks require accurate synchronization for correct operation. For example, if switches do not operate with the same clock rates, then slips will occur and degrade performance...

 used in telecommunication
Telecommunication
Telecommunication is the transmission of information over significant distances to communicate. In earlier times, telecommunications involved the use of visual signals, such as beacons, smoke signals, semaphore telegraphs, signal flags, and optical heliographs, or audio messages via coded...

 systems.

Stratum 0
These are devices such as atomic (caesium, rubidium) clocks
Atomic clock
An atomic clock is a clock that uses an electronic transition frequency in the microwave, optical, or ultraviolet region of the electromagnetic spectrum of atoms as a frequency standard for its timekeeping element...

, GPS clocks or other radio clock
Radio clock
A radio clock or radio-controlled clock is a clock that is synchronized by a time code bit stream transmitted by a radio transmitter connected to a time standard such as an atomic clock...

s. Stratum-0 devices are traditionally not attached to the network; instead they are locally connected to computers (e.g., via an RS-232
RS-232
In telecommunications, RS-232 is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between a DTE and a DCE . It is commonly used in computer serial ports...

 connection using a pulse per second
Pulse per second
A pulse per second is an electrical signal that very accurately repeats once per second . PPS signals are output by various types of precision clocks, including atomic clocks, radio clocks and some models of GPS receivers...

 signal).

Stratum 1
These are computers attached to Stratum 0 devices. Normally they act as servers for timing requests from Stratum 2 servers via NTP. These computers are also referred to as time servers.

Stratum 2
These are computers that send NTP requests to Stratum 1 servers. Normally a Stratum 2 computer will reference a number of Stratum 1 servers and use the NTP algorithm to gather the best data sample, dropping any Stratum 1 servers that seem obviously wrong. Stratum 2 computers will peer with other Stratum 2 computers to provide more stable and robust time for all devices in the peer group. Stratum 2 computers normally act as servers for Stratum 3 NTP requests.

Stratum 3
These computers employ exactly the same NTP functions of peering and data sampling as Stratum 2, and can themselves act as servers for lower strata. NTP (depending on what version of NTP protocol in use) supports up to 256 strata.

NTP timestamps

The 64-bit timestamps used by NTP consist of a 32-bit seconds part and a 32-bit fractional second part, giving NTP a time scale that rolls over
Integer overflow
In computer programming, an integer overflow occurs when an arithmetic operation attempts to create a numeric value that is too large to be represented within the available storage space. For instance, adding 1 to the largest value that can be represented constitutes an integer overflow...

 every 232 seconds (136 years) and a theoretical resolution of 2−32 seconds (233 picoseconds). NTP uses an epoch of January 1, 1900. The first rollover will occur in 2036, prior to the UNIX year 2038 problem
Year 2038 problem
The year 2038 problem may cause some computer software to fail at some point near the year 2038...

.

Implementations should disambiguate NTP time using a knowledge of the approximate time from other sources. Since NTP only works with the differences between timestamps and never their absolute values, the wraparound is invisible as long as the timestamps are within 68 years of each other. This means that the rollover will be invisible for most running systems, since they will have the correct time to within a very small tolerance. However, systems that are starting up need to know the date within no more than 68 years. Given the large allowed error, it is not expected that this is too onerous a requirement. One suggested method is to set the clock to no earlier than the system build date. Many systems use a battery powered hardware clock to avoid this problem.

Even so, future versions of NTP may extend the time representation to 128 bits: 64 bits for the second and 64 bits for the fractional-second. The current NTP4 format has support for Era Number and Era Offset, that when used properly should aid fixing date rollover issues until NTP5 replaces NTP4. According to Mills, "The 64 bit value for the fraction is enough to resolve the amount of time it takes a photon
Photon
In physics, a photon is an elementary particle, the quantum of the electromagnetic interaction and the basic unit of light and all other forms of electromagnetic radiation. It is also the force carrier for the electromagnetic force...

 to pass an electron
Electron
The electron is a subatomic particle with a negative elementary electric charge. It has no known components or substructure; in other words, it is generally thought to be an elementary particle. An electron has a mass that is approximately 1/1836 that of the proton...

 at the speed of light. The 64 bit second value is enough to provide unambiguous time representation until the universe goes dim
Ultimate fate of the universe
The ultimate fate of the universe is a topic in physical cosmology. Many possible fates are predicted by rival scientific theories, including futures of both finite and infinite duration....

."2−64 seconds is about 54 zeptoseconds (light would travel 16.26 picometres, or approximately 0.31 × Bohr radius
Bohr radius
The Bohr radius is a physical constant, approximately equal to the most probable distance between the proton and electron in a hydrogen atom in its ground state. It is named after Niels Bohr, due to its role in the Bohr model of an atom...

  ), and 264 seconds is about 585 billion years.

Clock synchronization algorithm

To synchronize its clock with a remote server, the NTP client must compute the round-trip delay time
Round-trip delay time
In telecommunications, the round-trip delay time or round-trip time is the length of time it takes for a signal to be sent plus the length of time it takes for an acknowledgment of that signal to be received...

 and the offset. The round-trip delay is computed as
,
where is the time of the request packet transmission, is the time of the request packet reception, is the time of the response packet transmission and is the time of the response packet reception. is the time elapsed on the client side between the emission of the request packet and the reception of the response packet, while is the time the server waited before sending the answer. The offset is given by
.

The NTP synchronization is correct when both the incoming and outgoing routes
Routing
Routing is the process of selecting paths in a network along which to send network traffic. Routing is performed for many kinds of networks, including the telephone network , electronic data networks , and transportation networks...

 between the client and the server have symmetrical nominal delay. If the routes do not have a common nominal delay, the synchronization has a systematic bias of half the difference between the forward and backward travel times.

Leap seconds

NTP delivers UTC time. UTC is subject to scheduled leap seconds to synchronize the timescale to the rotation of the earth. When a leap second is added, NTP is suspended for 1 second. Because NTP has no mechanism for remembering the history of leap seconds, leap seconds cause the entire NTP timescale to shift by 1 second.

Security concerns

Only a few security problems have been identified in the reference implementation of the NTP codebase in its 25+ year history. The protocol has been undergoing revision and review over its entire history; no security vulnerabilities have ever been reported that have been traced to the NTP specification. The current codebase for the reference implementation has been undergoing security audits from several sources for several years now, and there are no known high-risk vulnerabilities in the current released software.

See also

  • Allan variance
    Allan variance
    The Allan variance , also known as two-sample variance, is a measure of frequency stability in clocks, oscillators and amplifiers. It is named after David W. Allan. It is expressed mathematically as\sigma_y^2. \,...

  • Clock synchronization
    Clock synchronization
    Clock synchronization is a problem from computer science and engineering which deals with the idea that internal clocks of several computers may differ. Even when initially set accurately, real clocks will differ after some amount of time due to clock drift, caused by clocks counting time at...

  • International Atomic Time
    International Atomic Time
    International Atomic Time is a high-precision atomic coordinate time standard based on the notional passage of proper time on Earth's geoid...

  • ntpd
    Ntpd
    The Network Time Protocol daemon is an operating system daemon program that maintains the system time in synchronization with time servers using the Network Time Protocol .-Description:...

    , OpenNTPD
    OpenNTPD
    OpenNTPD is a Unix system daemon implementing the Network Time Protocol to synchronize the local clock of a computer system with remote NTP servers. It is also able to act as an NTP server to NTP-compatible clients....

     and Ntpdate
    Ntpdate
    ntpdate is a computer program used to synchronize and set computers' date and time by polling the Network Time Protocol server.The accuracy and reliability of ntpdate depends on the number of servers, the number of polls each time it is run and the interval between runs.The maintainers have...

  • NTP pool
    NTP pool
    The NTP pool is a dynamic collection of networked computers that volunteer to provide highly accurate time via the Network Time Protocol to clients worldwide. The machines that are "in the pool" are part of the pool.ntp.org domain as well as of several subdomains divided by geographical zone and...

    , a collection of worldwide computers that provide a highly accurate time via the Network Time Protocol
  • NTP server misuse and abuse
    NTP server misuse and abuse
    NTP server misuse and abuse covers a number of practices which cause damage or degradation to a Network Time Protocol server, ranging from flooding it with traffic or violating the server's access policy or the NTP . One incident was branded NTP vandalism in an open letter from Poul-Henning Kamp...

  • Synchronization
    Synchronization
    Synchronization is timekeeping which requires the coordination of events to operate a system in unison. The familiar conductor of an orchestra serves to keep the orchestra in time....

  • Time server
  • NITZ
    NITZ
    NITZ, or Network Identity and Time Zone, is a mechanism for provisioning local time and date, as well as network provider identity information to mobile devices via a wireless network. NITZ has been part of the official GSM standard since phase 2+ release 96...

     (Network Identity and Time Zone) a mechanism for provisioning local time and date, as well as network provider identity information to mobile devices via a wireless network


Other time synchronization protocols:
  • DAYTIME protocol
    DAYTIME
    The Daytime Protocol is a service in the Internet Protocol Suite, defined in 1983 in RFC 867. It is intended for testing and measurement purposes in computer networks....

    , older time synchronization protocol using TCP or UDP port 13
  • ICMP Timestamp
    ICMP Timestamp
    The Timestamp is an ICMP message which is used for time synchronization. It consists of the originating timestamp.Message Format: * Type must be set to 13.* Code must be set to 0....

     and ICMP Timestamp Reply
    ICMP Timestamp Reply
    The Timestamp Reply is an ICMP message which replies to a Timestamp message. It consists of the originating timestamp sent by the sender of the Timestamp as well as a receive timestamp and a transmit timestamp.Message Format:...

    , older time synchronization protocol using ICMP
  • Precision Time Protocol
    Precision Time Protocol
    The Precision Time Protocol is a protocol used to synchronize clocks throughout a computer network. On a local area network it achieves clock accuracy in the sub-microsecond range, making it suitable for measurement and control systems....

    , a high-precision protocol for use on local area networks
  • Time Protocol
    TIME protocol
    The Time Protocol is a network protocol in the Internet Protocol Suite defined in 1983 in RFC 868. Its purpose is to provide a site-independent, machine readable date and time....

    , older time synchronization protocol using TCP or UDP port 37

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK