内网有一台Rocky Linux8.4的服务器,想设置时间同步,发现ntpdate不能用,经查,可使用chrony模块来实现。
查看系统版本
[root@SVN ~]# cat /etc/redhat-release
Rocky Linux release 8.4 (Green Obsidian)
修改chrony配置文件
vim /etc/chrony.conf
- 因为我这边有内网NTP服务器192.168.1.120,所我就改成下面这样
[root@SVN ~]# cat /etc/chrony.conf | grep -Ev '^$|#'
server 192.168.1.120 iburst
server ntp.aliyun.com iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
重启服务
systemctl restart chronyd.service
同步
[root@SVN ~]# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.1.120 2 6 17 3 +3788ns[ +47us] +/- 134ms
[root@SVN ~]# date
2022年 06月 07日 星期二 09:13:55 CST