通过自构建的时间服务器主机给客户端主机同步时间
主机
1.网络
ip a --->192.168.217.133/24
2.关闭防火墙 关闭selinux
[root@yyy ~]# systemctl stop firewalld
[root@yyy ~]# setenforce 0
3./etc/chrony.conf
vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
#pool 2.rhel.pool.ntp.org iburst
server ntp.aliyun.com iburst
# Use NTP servers from DHCP.
sourcedir /run/chrony-dhcp
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow NTP client access from local network.
allow 192.168.217.129/24
# Serve time even if not synchronized to a time source.
local stratum 10
4.重启服务
[root@yyy ~]# systemctl restart chronyd
客户端
1.网络
192.168.217.129/24
2./etc/chrony.conf
vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
server 192.168.217.133 iburst
# Use NTP servers from DHCP.
sourcedir /run/chrony-dhcp
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
3.重启服务
[root@yyy ~]# systemctl restart chronyd
4.检验
[root@yyy ~]# chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.217.133 3 6 17 12 +11us[ +38us] +/- 23ms
