What is an NTP Server?
A network time protocol (NTP) server is a server on a local area network (LAN) or wide area network (WAN) that is configured to synchronize the system clocks of other devices or servers on the network to a referenced time source. NTP uses the User Datagram Protocol (UDP) port number 123 to send and receive timestamp information.
How Does an NTP Server Work?
An NTP server synchronizes clocks by communicating with multiple referenced time sources over the internet and then averaging the timestamps it receives to determine the correct time. It will then synchronize the system clocks of computers, servers, networking equipment and any other NTP client devices on the local network to this averaged time.
The main mechanism used by NTP is a hierarchical, distributed, and self-organizing system that can select accurate time sources, such as atomic clocks located at national laboratories, and then propagate this information across the internet to the computer workstations around the world.
Sources of Timestamped Reference Time
There are a variety of time sources that an NTP Server can use as a reference to determine accurate timestamps for synchronization purposes:
- Atomic Clocks: Highly precise cesium or rubidium atomic clocks located at national physics laboratories provide the most accurate reference time and serve as primary NTP time sources at the top of the timing hierarchy.
- GPS Satellites: Precise timekeeping from GPS satellites in orbit provides another common reference source used by many NTP servers situated with a clear view of the sky and GPS antenna.
- Radio Clocks: Land-based time signal radio stations such as WWVB or DCF77 broadcast extremely precise timing signals that can be received by special radio clock hardware to provide another level of reference input.
- Parent Servers: NTP servers situated higher up in the timing hierarchy can be configured as parent servers to provide reference time to lower level child NTP servers further downstream.
Synchronization Process
The synchronization process works as follows:
- The NTP server queries the multiple configured time sources simultaneously to get timestamp responses and determine the correct time.
- It analyzes timestamps from the references using a mathematical algorithm to account for network latency and determines the best candidate time source.
- The server calculates the error between its own clock and the reference source and adjusts its clock speed to keep it synchronized.
- It periodically re-evaluates the references and synchronization adjustments to constantly improve time accuracy over minutes, hours, and days through the feedback loop process.
- The server then shares the synchronized time to clients on the local network using the NTP protocol to keep their system clocks aligned within milliseconds of true time.
Factors Affecting Accuracy
There are several factors that can affect the accuracy of synchronization provided by an NTP server:
- Number and Location of References: Using diverse, well-placed references like GPS, atomic clocks improves accuracy over a single source.
- Network Conditions: Propagation delays and variable latency over the internet between server and references introduces error that refinement algorithms try to eliminate.
- Hardware Clock Quality: Better hardware clocks on servers and workstations, with stability, frequency, and persistence help the NTP feedback loop converge to lower error states.
- Size of NTP Pool: Larger pools of public NTP servers provide redundancy, increasing probability of always having a functioning time source.
- Poll Interval: More frequent polling allows the NTP process to detect and correct for drift and offset errors sooner.
With careful configuration of accurate references and consideration of the synchronization environment, most NTP servers can provide time accuracy within tens of milliseconds. Certain stratum 1 servers embed atomic clock hardware for accuracy measured in microseconds.
Get More Insights on NTP Server