02-NTP 服务.note
1、在服务器 和 客户端上都下载 chrony:
apt install -y chrony2、服务器配置:
vim /etc/chrony/chrony.conf
# 注释掉官方的 pool 地址池
# 在 末尾输入:
allow 0.0.0.0/0
local stratum 1·重启服务:
systemctl restart chrony3、客户端配置:
vim /etc/chrony/chrony.conf
# 注释掉官方的 pool 地址池
# 在 末尾输入:
server 47.119.161.25 iburst·重启服务:
systemctl restart chrony4、修改时间,进行时间同步:
date -s "12:32" //修改时间
systemctl restart chrony //重启服务进行时间同步5、设置 crontab ,自动进行时间同步:
vim /etc/crontab
# 在末尾添加:
* * * * * root systemctl restart chrony6、查看时间同步状态:
chronyc sources同步成功的状态即为:
