2025.10.21作业
1. 检查chrony是否安装
[root@localhost ~]# rpm -qa | grep chrony
chrony-4.3-1.el9.x86_64
[root@localhost ~]# ps -aux | grep chrony
chrony 898 0.0 0.1 84380 3420 ? S 15:07 0:00 /usr/sbin/chronyd -F 2
root 3511 0.0 0.1 221796 2380 pts/1 S+ 16:40 0:00 grep --color=auto chrony
2.编辑服务端配置文件
[root@localhost ~]# vim /etc/chrony.conf
#切换至第三行,更改配置内容为server ntp.aliyun.com iburst#启用如下两行命令
# Allow NTP client access from local network.
allow 192.168.95.0/24# Serve time even if not synchronized to a time source.
local stratum 10
3.重启服务,等待客户端连接
[root@localhost ~]# systemctl restart chronyd.service
二.客户端连接
1.检查chrony安装情况
[kehu@localhost ~]$ rpm -qa | grep chrony
chrony-4.3-1.el9.x86_64
[kehu@localhost ~]$ ps -aux | grep chrony
chrony 929 0.0 0.1 84380 3340 ? S 08:11 0:00 /usr/sbin/chronyd -F 2
kehu 6560 0.0 0.1 221796 2328 pts/1 S+ 08:14 0:00 grep --color=auto chrony
[kehu@localhost ~]$
2.配置客户端chrony
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
pool 192.168.117.128 iburst
3.重启chrony,加载新配置以连接服务器
[root@kehu ~]# systemctl restart chronyd
4.测试
[root@client ~]# date -s 14:12:12
Wed Oct 29 02:12:12 PM EDT 2025
[root@client ~]# systemctl restart chronyd.service
[root@client ~]# date
Wed Oct 29 02:12:42 PM EDT 2025
