Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 26 章 Synchronizes system time using the Network Time Protocol (NTP)

目录

26.1. chronyd
26.2. OpenNTPD
install
ntpdate
ntpd.conf / ntp.conf
ntpstat - show network time synchronisation status
ntpq - standard NTP query program

http://www.ntp.org

26.1. chronyd

chronyd 是 ntpd 的替代品,在 CentOS 8 中 chronyd 取代了 ntpd 的位置

安装

		
dnf install -y chrony
systemctl enable chronyd
systemctl start chronyd		
		
		

chrony 的配置文件位于 /etc/chrony.conf

查看同步状态

		
[root@localhost ~]# chronyc tracking
Reference ID    : CB6B0658 (203.107.6.88)
Stratum         : 3
Ref time (UTC)  : Tue Jul 13 08:39:57 2021
System time     : 0.000333415 seconds fast of NTP time
Last offset     : +0.001497547 seconds
RMS offset      : 0.000643134 seconds
Frequency       : 9.239 ppm fast
Residual freq   : +0.134 ppm
Skew            : 1.942 ppm
Root delay      : 0.053295419 seconds
Root dispersion : 0.001933562 seconds
Update interval : 256.4 seconds
Leap status     : Normal		
		
		

查看同步时间服务器列表

		
[root@localhost ~]# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^- a.chl.la                      2   8   372   643    -30ms[  -28ms] +/-  143ms
^- ntp1.flashdance.cx            2   8   177   455  +1760us[+3207us] +/-  166ms
^* 203.107.6.88                  2   9   377   193  +2478us[+3976us] +/-   27ms
^- ntp8.flashdance.cx            2   8   135   445  -8210us[-6856us] +/-  183ms