Linux implements NTP through Chrony

Linux implements NTP server time synchronization, which can be realized through ntp service or chrony service

The difference between the two is mainly

 Chrony runs on UDP port 323, NTP runs on UDP port 123

 Chrony can be synchronized faster than NTP, and can maximize synchronization to reduce time and frequency errors

 Chrony responds better to rapid changes in clock frequency, which is useful for VMs with unstable clocks

 Chronyc does not need to periodically poll the server, and can still quickly synchronize the clock for systems with intermittent network connections

Chrony mainly includes two core components

chronyd: A daemon that can be started at boot time to adjust the system clock running in the kernel to synchronize with the NTP server

chronyc: a command-line interface program that monitors the performance of chronyd and changes various operating parameters while it is running

Configure Chrony

install chrony

yum -y install chrony

systemctl start chronyd.service

systemctl enable chronyd.service

Configure the main configuration file of chronyc -- the main configuration file of chrony is /etc/chrony.conf

vim /etc/chrony.conf

 server NTP server address iburst

 allow 172.25/16 allows 172.16 to access the NTP server

NTP synchronization through iburst, the first synchronization time will be faster

supplementary configuration

firewall-cmd --add-service=ntp --permanent release ntp service

firewall-cmd --reload

firewall-cmd --list-all

timedatectl set-ntp true change ntp synchronization to true

systemctl restart chronyd.service Restart the chrony service

authenticating

chronyc activity -v Check if ntp_server is online

chronyc -a makestep Force synchronization of the system clock

chronyc tracking -v View ntp details

chronyc sources -v to verify

 * means synchronized

 ? Indicates unreachable

timedatectl View system time

Commonly used NTP servers

time1.cloud.tencent.com

time.aliyun.com

time.apple.com

asia.pool.ntp.org

Guess you like

Origin blog.csdn.net/m0_49864110/article/details/130330969