1、准备工作: 服务器端: 192.168.44.7 系统:centos7
客户端:192.168.44.6 系统: centos6
2、安装软件,启动服务
yum install chrony
systemctl start chronyd
systemctl enable chronyd
3、对chrony的配置文件进行修改,配置服务器端
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 192.168.44.7 iburst ##设置服务器的ip地址
允许服务的ip网段
# Allow NTP client access from local network.
allow 192.168.44.0/24 ##设置允许的ip网段
# Serve time even if not synchronized to a time source.
local stratum 10 ##开启,即使server指令中时间服务器不可用,也允许将本地时间作为标准时间授予其他客户端
4、客户端设置
yum install chrony
service chrony start
配置文件中,指向chrony服务器地址就好了
service chrony restart
5、测试
将centos6的时间改错,只要重启chrony服务,时间便会同步
chronyc sources -v 查看同步时间的状态