服务器端:
1.安装chrony。
bash
yum install chrony -y
systemctl start chronyd
systemctl enable chronyd
systemctl status chronyd
2.配置文件中添加chrony服务器地址和允许时间同步网段。
bash
vim /etc/chrony.conf
server 192.168.0.249 iburst
allow 192.168.0.0/24
3.启用NTP。
bash
systemctl restart chronyd
timedatectl set-ntp true
4.查看时间源。
bash
chronyc sources -v
5.手动同步时间。
bash
chronyc -a makestep
6.防火墙开放NTP服务。
bash
firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
7.显示状态。
bash
timedatectl
bash
ntp enabled: yes
ntp synchronized: yes