注意点
1.启动ntp服务器前需要ntpdate 服务器ip地址
这么做是为解决ntp服务器时钟和本地时钟在超过1000s误差时不会同步时间
2.ntpdate后vim /etc/ntp.conf
注释所有现有的server,添加server 服务器ip地址
,同理注释所有restrict,添加restrict 服务器ip地址
,修改本地时间服务器的等级为stratum 11
,保存后重新启动ntp服务。
3.systemctl start ntpd,等待8分钟左右开始同步时间,可用ntpq -p
查看时钟源,ntpstat
查看时间同步状态
详细原理https://blog.51cto.com/zhaoanan/2402627