1、服务器安装服务
apt install chrony
2、修改配置文件
nano /etc/chrony/chrony.conf
末尾添加:
local
allow
启动服务 systemctl start chrony
3、客户端配置
安装chrony ntpdate
apt install chrony ntpdate
crontab -e #选择2
*/5 * * * * ntpdate 192.168.200.100 #每5分钟向服务器进行时间同步
systemctl restart ntpdate #启动服务
crontab -l #查看配置
4、测试
ntpdate 192.168.200.100 #无法同步关闭chrony服务,启动ntpdate服务
chronyc clients #服务器也可查看校准的客户端