#Concept A protocol used to keep the time clocks on networked appliances in sync. Satellites that make up GPS contain more than one atomic clock. Their time is very accurate. Time can be synced via GPS or low frequency radio, but this is not the common use case. Commonly NTP is used with network servers. NTP is used to synchronize the (not very accurate) [[../../Concepts/IT/RTC (Real Time Clock|RTC (Real Time Clock|[Real Time Clock)]]]].md) ## Why is it important in IT? There are several reasons, first being logs. Accurate timestamps in logs are important for troubleshooting and aggregation. ## Strata Strata indicate the synchronization distance from an atomic clock (GPS/low frequency radio). Strata can range from 1 to 15. Atomic clocks are Stratum 0. Each server that forwards an NTP request adds +1 to the stratum. For example: Atomic Clock (Stratum 0) → NTP Server 1 (Stratum 1) → NTP Server 2 (Stratum 2) → Client (Stratum 3). Stratum 16 is used to indicate that the server is not currently synchronized. ## Workings ### Determining Round Trip Time First, the round trip time between the NTP Server and Client is determined. NTP sends an originate timestamp. The server then adds a receive timestamp. After processing the request, the server adds a transmit timestamp. The client calculates round trip time, assuming both directions take the same amount of time. ### Adjusting System Clock The difference between the calculated value received from the NTP server and the system clock is adjusted slowly (2000 seconds to adjust the clock by 1 second). This change is called slewing. If the offset is more than 128ms, the clock can "step" forward or backwards. If the offset is greater than 1000 seconds (~17 minutes), a manual adjustment must be made. ### Drift File Used to store the offset between the system clock and the frequency required to remain in synchronization. It is usually read at system start and used to correct the clock source. The file is replaced once per hour by ntpd. ### Leap Seconds GMT (Greenwich Mean Time) is based on the earth's rotation. TAI (International Atomic Time) is far more accurate. UTC is based on TAI. To synchronize TAI-based time with GMT, a leap second is added irregularly. The decision on when this happens is made by IERS (International Earth Rotation and Reference Systems Service). NTP transmits information about leap seconds automatically. ## Different Types of NTP Solutions in Linux ### chrony https://access.redhat.com/documentation/de-de/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-Configuring_NTP_Using_the_chrony_Suite ### ntpd https://access.redhat.com/documentation/de-de/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_ntpd ## 🔗Resources https://access.redhat.com/documentation/de-de/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_ntpd