In the world of modern computing, accurate and synchronized timing is everything. As networks grow increasingly complicated, they demand strong standards that ensure everything is running on the same unified schedule.

The simplest way you can handle this is with the help of Network Time Protocol or NTP in short. It is one of the oldest protocols and is still in use as a means of network timekeeping.

Network Time Protocol is a standard TCP/IP protocol used for synchronizing different computer clock times across data networks. It was developed in 1981 by David Mills at the University of Delaware.

Known for high fault-tolerance and scalability, it helps in achieving highly accurate time synchronization. It follows a client-server model whereby a client requests time from an NTP server, and subsequently, the server responds.

To get a proper understanding of NTP, we will first know the importance of accurate timing across the Internet or networks. Then, we will discuss in detail everything about NTP – how it syncs time, its features, and the hierarchical architecture of NTP, etc.

Let’s begin!

Why is time synchronization important in a network?

Imagine you have an internetwork of a hundred or more routers and twice that many switches. Now imagine the effort that you need to put to make sure that all these devices have the same time.

Now, you must be wondering “Why should I even worry about having same time?”

Well, time provides the only frame of reference between all devices in a network. That’s why synchronizing time becomes indispensable.

Without synchronized time it will be difficult for you, if not impossible, to correlate information between devices accurately.

If one device becomes ahead of the others, automatically the others will be behind that particular device.

From the outlook of an external observer, switching between these devices will cause time to hop forward and back. It is a non-desirable effect.

As a result, remote networks may run their own incorrect time, but as soon as you connect to the Internet, effects will be noticeable.

In the case of a single computer too, some applications have a problem when the time jumps backward. For instance, database systems using transactions and crash recovery need to know the time of the last good state.

Deviations of even fractions of a second can result in issues. For instance, distributed procedures rely on coordinated times to ensure the following of proper sequences.

Also, when some computers carry out file-system updates, it also depends on synchronized clock times.

Network acceleration and network management systems also depend on the accuracy of timestamps to compute performance and troubleshoot problems.

What is the Network Time Protocol (NTP)?

Network Time Protocol (NTP) is a standard networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.

To achieve synchronization, NTP relies on coordinated universal time (UTC), which it obtains from the individual clients and servers in a hierarchical system.

Running as a continuous background client program on a computer, NTP sends periodic time requests to servers, obtaining server time stamps and using them to adjust the client’s clock.

It is currently in its fourth major version, NTPv4, defined in RFC 5905. NTPv4 is backward compatible with version 3, specified in RFC 1305.

NTP transmits and receives timestamps using the user datagram protocol (UDP), which enables connectionless data transport. The UDP port number for this is 123.

What are the features of NTP?

Now, let’s see some of the basic features of the network time protocol

Use of Coordinated Universal Time (UTC)

NTP provides a reference clock that acts as a fixed point for all synchronization processes. The coordination of all the other clocks is according to this clock or time.

Right from the start, the coordinated universal time (UTC), which is known as a uniform world time clock, is used as a reference time for this purpose.

Fault-tolerant

NTP is a fault-tolerant protocol that will search for the best time sources for synchronization.

Several sources can be combined to minimize any error accumulation affecting the synchronization.

If possible, the network time protocol recognizes and ignores time sources that temporarily or permanently submit strongly deviating values.

Even when a network connection is unavailable for a brief period, NTP can apply measurements from the past to evaluate current time and error.

Scalability

Another great feature of NTP is that it is highly scalable. A synchronization network may include several reference clocks.

Furthermore, each node of such a network can transmit time information either bidirectional (point-to-point) or unidirectional.

Transmission of time from one node to another creates a hierarchical graph with reference clocks at the top.

High Accuracy

NTP is highly accurate. Thanks to the possibility of selecting the best candidate for synchronization, accuracy up to one nanosecond is possible.

NTP can generally maintain time to within tens of milliseconds over the public Internet. It can also achieve better than one-millisecond accuracy in local area networks under ideal conditions.

How does NTP sync time? How NTP works?

NTP uses the concept of a client and server. The source of time information is the server, and a system that is attempting to synchronize its clock to a server is the client.

Types of Servers

Servers can be of two types, either a primary server or a secondary server.

A primary server is a server that receives a UTC signal right from an authoritative clock source, such as a configured atomic clock or, a Global Positioning System (GPS) signal source.

On the other hand, a secondary server gets its time signal from one or more upstream servers and disseminates its time signal to one or more downstream servers and clients.

You can think of secondary servers as clock signal repeaters, and their function is to alleviate the client query burden from the primary servers.

However, they can still provide their clients with a clock signal of comparable quality to that of the primary servers.

The secondary servers demand arrangement in a strict hierarchy concerning upstream and downstream. The ‘stratum’ terminology is often used to help in this process.

What is Stratum?

NTP employs a hierarchical, semi-layered system of time sources. Each layer of this hierarchy is known as a stratum and gets a number beginning with zero for the reference clock present at the top.

A server synchronized to a stratum n server functions at stratum n + 1. The number depicts the distance from the reference clock and helps in preventing cyclical dependencies in the hierarchy.

A stratum one server receives its time signal from a UTC reference source. A stratum two server receives its time signal from a stratum one server, a stratum three server from stratum two servers, and so on.

This stratum framework helps in avoiding synchronization loops within a set of time servers.

NTP can go up to 16 different stratum levels. The accuracy of the devices decreases as lower down the hierarchy you go. However, to increase reliability, each client can accept a time source from multiple servers.

Stratum 0

Stratum 0 devices are high-precision timekeeping devices that include atomic clocks, GPS or Radio clocks. They produce a very accurate pulse per second signal that activates an interrupt and timestamp on a connected computer.

The term Reference clock is also applicable to Stratum 0 devices.

Stratum 1

A primary that server that receives a time signal from a stratum 0 device is known as a stratum 1 device. It can achieve microsecond-level synchronization with Stratum 0 clocks.

Stratum 1 servers may peer with another stratum one servers for a sanity check and backup.

Stratum 2

Stratum 2 refers to computers that synchronize over a network to stratum 1 servers. Many times, a stratum 2 computer will query several stratum one servers.

Stratum 2 computers may also peer with another stratum 2 computers to deliver more stable and robust time for all devices in that peer group.

Stratum 3

Stratum 3 devices synchronize to stratum 2 servers. They use the same algorithms for peering and data sampling as stratum 2. Also, they can themselves act as servers for stratum 4 computers, and so on.

The NTP client establishes a time-request exchange with the NTP server. As a result, the client can compute the link delay and its local offset and adjust its local clock to coordinate with the clock at the server’s computer.

As a rule, six exchanges for about five to ten minutes are required to set the clock initially.

Once synchronized, the client updates the clock about once every ten minutes, usually requiring only a single message exchange.

NTP Modes of Operation

NTP synchronizes timekeeping between a group of distributed time servers and clients. This synchronization allows the correlation of events during the creation of system logs, and when other time-specific events occur.

NTP operates in four different modes.

Server Mode

The configuration of Server Mode is in a manner that a device will synchronize all NTP clients or only a particular group of clients.

However, NTP servers, will not accept synchronization information from their clients. This restriction will not permit clients to update or manipulate a server’s time settings.

Client Mode

The configuration of Client Mode allows a device to set its clock by and synchronized by an external time server.

You can configure NTP clients to utilize multiple servers to set their local time and to give priority to the most accurate time sources available to them.

However, they will not provide synchronization services to any other devices.

Peer Mode

Peer Mode refers to the mode an NTP-enabled device has no authority over another.

In the Peer mode, each device will exchange its time information with its peer. Also, each device can also offer time synchronization to the other.

NTP servers that operate in the same stratum can be connected with others in a peer to peer basis. So, they can determine who has the higher quality of time and then can synchronize to the most accurate.

Broadcast/Multicast Mode

In this mode, the NTP server broadcasts its synchronization information to all clients.

In the case of Broadcast mode, clients must be on the same subnet as the server. The Multicast mode requires that clients and servers have multicast capabilities configured.

What are the advantages of the Network Time Protocol?

NTP timekeeping is a critical aspect of the modern Internet as it provides some significant advantages:

  • Quick deployment of NTP is possible on servers hosting different services.
  • NTP also requires less resource overhead.
  • NTP does not need very high bandwidth.
  • At a time, NTP can handle hundreds of clients with minimum CPU usage.
  • NTP also includes embedded security capabilities.

Which operating systems support the NTP Protocol?

Initially, the network time protocol was developed primarily for UNIX systems, in which the implementation of the protocol is still in the form of the background process ntpd.

It serves both as a client that can synchronize the local system and as an NTP server for other systems.

Today, however, NTP runs with many UNIX-like systems.

MacOS and Windows operating systems now also use the network time protocol to obtain UTC via the internet with simple system processes and without additional software.

Now, NTPv4 is available for Windows, and you can implement it on Windows NT, Windows 2000, XP, Vista and Windows 7.

Final thoughts on Network Time Protocol

To summarize, NTP is the standard protocol used for time synchronization across computer servers, workstations and a plethora of other network devices. It presents an easy way to guarantee that all of our network devices have the same time with a high rate of accuracy and stability.  In the case of smaller networks, this is a good thing, and in large networks, it is essential.

Inaccurate time across network devices can have a direct impact on network security and network management. A dedicated NTP server keeps your network secure while providing more precise time stamping.

Today, much of the distributed Internet service infrastructure relies on a standard time base, and the Network Time Protocol can provide this base.

Now that you know how Network Time Protocol can help you to achieve time synchronization in a network, why don’t you share this idea with others and save their time too!

Network Time Protocol (NTP) is a standard networking protocol for clock synchronization between computer systems over variable-latency data networks. It follows a client-server model whereby a client requests time from an NTP server, and subsequently, the server responds.