安装chrony服务器
[root@localhost ~]# yum -y install chrony
或ubuntu
root@BJ-long:~# apt install chrony -y
改配置
[root@localhost ~]# vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 0.0.0.0/0
# Serve time even if not synchronized to a time source.
local stratum 10
重启服务并开机启动
[root@localhost ~]# systemctl enable --now chronyd
查看同步时间的服务器ip
[root@localhost ~]# chronyc sources -v
配置客户端
[root@localhost ~]# yum -y install chrony
修改配置文件(centos系统