NTP is the abbreviation of Network Time Protocol, which is used to synchronize the time of each computer in the network.
In various information systems, time consistency between devices is very important. For example, for scientific research activities such as rocket launch, there are very high requirements for time uniformity and accuracy. Whether it is based on the time of computer A or B, if the time is not consistent, it will cause abnormal overall work and even lead to accidents. The NTP network Time Protocol is used to solve the problem of time unification in various information systems.
The NTP network Time Protocol is a protocol used to synchronize the time of each computer in the computer network. It is an application layer protocol in the TCP/IP protocol family. The NTP network Time Protocol is used to synchronize the computer clock between a series of distributed time servers and clients. The implementation of NTP protocol is based on IP protocol and UDP protocol. NTP packets are transmitted through UDP with port number 123. The NTP protocol can synchronize a computer's clock to Universal Time Coordinated UTC (Universal Time Coordinated), with a synchronization accuracy of up to 0.1ms in a local area network and 1-50ms in most parts of the internet. The NTP protocol enables computers to synchronize time with their servers or clock sources (such as quartz clocks, Beidou/GPS, etc.), providing high-precision time correction, and using encrypted confirmation to prevent virus protocol attacks.
The standard time used by the NTP network Time Protocol is the international standard time UTC (Universal Coordinated Time), which is announced by the atomic clock. In China, it is the Beijing time maintained and broadcast by the National Time Service Center of the Chinese Academy of Sciences. Beijing time is maintained by the National Time Service Center through ultra-high precision atomic clock sets and broadcast through Beidou satellites, long and short wave radios, television signals, and other means. Therefore, NTP can obtain Beijing time from Beidou satellites, atomic clocks, or observatories, as well as from the Internet. Due to the advantages of high accuracy and convenient reception of Beidou satellite signal broadcasting time, NTP network time servers usually use Beidou satellite signals as authoritative time sources.
With an accurate and reliable time source, how can this time spread? In the NTP protocol, time is defined to propagate according to the level of the server, which categorizes all servers into different Stratum (layers) based on their proximity to external UTC time sources. For example, the server that obtains the standard transmission time through the Beidou satellite is called the NTP server of Stratum-1, while Stratum-2 obtains the time from Stratum-1, Stratum-3 obtains the time from Stratum-2, and so on, but the total number of Stratum layers is limited to 15. All these servers are logically connected in a hierarchical architecture, and Stratum-1's time server is the foundation of the entire system.
The NTP network time server is a time source server for lower level clients, while for upper level NTP servers, it is a client. The new version of the NTP service program no longer distinguishes between the server and client, and is uniformly called ntpd. NTPD determines whether to provide clock services to other servers or synchronize clocks from other servers based on the parameters in the configuration file. In Linux operating systems, all configurations of NTPD are generally in the/etc/ntp.conf file.
How often does the NTPD service request clock synchronization from the clock server? According to the usual understanding, the faster the better, preferably synchronizing every second. Due to the fact that each computer's motherboard has an internal crystal oscillator that can maintain a certain level of accuracy for a short period of time, the NTPD service can perform clock synchronization requests at a time interval. The default minimum time interval is 64s, and the default maximum time interval is 1024s (approximately 17 minutes). 64s is relatively reasonable, as it can ensure the timeliness of time synchronization while also taking into account the performance of the NTP server, allowing the NTPD service to serve more clients at the same time. The default interval can also be adjusted by modifying the configuration file.
Since the NTP network time server adjusts the time of various devices in the computer network, can it adjust all the time deviations? NTP services do not synchronize under any circumstances. When the difference between the clock server time and the local time is greater than 1000 seconds, the NTP service will consider it as a human error in adjusting the clock or a hardware malfunction, such as a damaged CMOS battery. These are serious issues for time adjustment. At this point, the NTPD service will exit and log to remind users to check, and manual clock synchronization is required. The "- g" option can be used when starting the ntpd service to ignore errors of 1000 seconds or more.
The installation of NTP servers has a concept of hierarchy in the network. The hierarchy of a certain NTP server is set based on the hierarchy of its upper NTP server (+1 on top of the upper NTP server hierarchy). For hosts providing network time servers, the setting of the hierarchy should be as accurate as possible. As a subordinate time server in the local area network, the stratum is usually set to 10, as follows:
Server 127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10
#Stratum can also be set to other values, with a range of 0-15
The above is a brief introduction to NTP network time servers. As a long-standing and widely used network protocol in computer networks, NTP has played an important role in various information systems and has become the standard solution for time uniformity in computer networks. If readers want to gain a deeper understanding of NTP network time servers, it is recommended to consult professional books or technical materials.
微信扫码 关注我们
24小时咨询热线010-56888014
移动电话13391763437
Copyright @ 2023 Beijing XinSheng inc All Rights Reserved. 地址:26 Shangdi Information Road, Haidian District, Beijing 京ICP备2022035422号 XML地图 网站模板