环境
192.168.100.10 服务端
192.168.100.11 客户端
192.168.100.12 客户端
1.确认防火墙和selinux已经停止
2.yum -y install chrony
3.服务端配置
vim /etc/chrony.conf
##将默认server注释掉,添加国内时间服务器
#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 ntp.aliyun.com iburst
......
# Allow NTP client access from local network.
#allow 192.168.0.0/16 添加需要访问此时间服务器的客户端网段
allow 192.168.0.0/16
启动时间服务器
systemctl restart chronyd
4.客户端配置
vim /etc/chrony.conf
#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注释掉,添加为配置好的时间服务器
server 192.168.100.10 iburst
systemctl restart chronyd
查看时间同步信息可执行如下命令
chronyc sources
注:如果时间同步正常后,擅自更改时间,同步时间会需要较长的时间,此时可以重启chronyd服务,重启后会快速同步时间,因为配置了iburst,重启后的短时间内会高频次同步时间.
国内的其他时间服务器如下:
# 国家服务器
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
# 阿里
server ntp.aliyun.com
# 腾讯
server time1.cloud.tencent.com
server time2.cloud.tencent.com
server time3.cloud.tencent.com
server time4.cloud.tencent.com
server time5.cloud.tencent.com
# 苹果
server
time
.asia.apple.com
# 微软
server
time
.windows.com
# 其他