Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 9 February 2020

LINUX (47)- NETWORK TIME PROTOCOL (NTP) -1



               LINUX (47)- NETWORK TIME PROTOCOL (NTP) -1


Network Time Protocol (NTP) is an Internet Protocol used for synchronization of computer clocks with some external time reference for précised timing. Or NTP is a system which is responsible to provide accurate timing to systems across the internet.

NTP is an application layer protocol works within the TCP/IP suite and relies on UDP on port 123.


Why it is required?
Well, if I am running a standalone system then I can manage with time but in world of internet timing is extremely important, consider banking systems where mismatch of seconds can do disaster, your database systems, your High Availability system, your DR systems… all need to be synchronized.

So, hope you understand time management is how important in life as well as in computer systems… 😊

Now the question is, from where NTP is getting time?

From Reference Clocks… … what is this reference clock?

A reference clock is known as stratum 0 and is typically a cesium clock or a Global Positioning System (GPS) that receives time from satellites.

Ohhhoo.. what is Stratum?

Distance from the reference clock is termed as stratum,

NTP works in client-server hierarchy distributed in top to bottom hierarchy, and a stratum is one layer in network of layers from 1 to 15.

                   


Atomic clock is termed as Stratum 0, and layer 1 devices (Stratum 1) are taking time from stratum 0. Then stratum 2 devices obtain their time from stratum 3, and so on down.

Stratum 0 devices cannot distribute time over a network directly, though, hence they must be linked to a Stratum 1 time server that will distribute time to Stratum 2 servers or clients, and so on. The higher the Stratum number, the more the timing accuracy and stability degrades.

The NTP protocol does not allow clients to accept time from a Stratum 15 device, hence Stratum 15 is the lowest NTP Stratum.
The label Stratum 16 is used to indicated an unsynchronized state.

A group of NTP servers at the same Stratum level (Stratum 2, for example) are considered NTP Peers to each other.

NTP servers operating in the same stratum may be associated with others in a peer to peer basis, so they may decide who has the higher quality of time and then can synchronize to the most accurate.

NTP Servers at a higher Stratum level, are referred to as NTP Servers. These devices are configured to supply time information to NTP clients utilizing Network Time Protocol.

NTP servers will only supply time information to authorized NTP clients and will not receive time synchronization information from unauthorized devices. It works in Client/Server model.


There are three fundamental modes in which the NTP exchange can operate:

·       Client/Server mode: The client requests and the server respond. The server will be a higher stratum (i.e., lower stratum number) device than the client. So, the client's time converges onto the server's time.

·       Peer-to-peer mode: Both devices in the conversation act as requesters and responders to each other. The peer devices are both at the same stratum. The devices' times converge to each other.

·       Broadcast/Multicast Mode: is a special server mode where the NTP server broadcasts its synchronization information to all clients. Broadcast mode requires that clients be on the same subnet as the server, and multicast mode requires that clients and servers have multicast capabilities configured. In instances where time accuracy and reliability are not crucial, clients can be configured to utilize broadcast/multicast modes. The benefit of these modes is that clients do not need to be configured to a particular server, enabling all operating clients to utilize the same configuration file.


Let’s say A device that is operating as a client to a stratum 2 server can, at the same time, also be operating as a server to other, lower-stratum clients.




1 comment: