主机时间同步阿里云
centos8: yum -y install chrony
centos7:yum -y install chrony
1. 同步主机: 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
配置允许其他主机同步你:
# Allow NTP client access from local network.
allow 192.168.159.0/24
# Serve time even if not synchronized to a time source.
local stratum 10 # 建议开启, 此配置表示, 即使本机(NTP服务器)无法与互联网的NTP服务器进行同步, 也会继续给局域网内部的主机提供时间同步服务
启动服务:
ss -nlu
客户端时间同步
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 192.168.159.217 iburst
重启:
systemctl restart chronyd
查看同步是否成功
chronyc sources -v