chrony配置时间源服务:

vi /etc/chrony.conf

1. 注释掉外网的NTP源

#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

2. 添加白名单

allow 192.168.0.0/16

3. 打开本地时间源,并调整stratum

开启本地时间源:

local stratum 5

4. 启动chronyd服务:

systemctl restart chronyd && systemctl enable chronyd && systemctl restart chronyd && systemctl status chronyd

5. 示例:

sed -i 's/server /#server /g' /etc/chrony.conf;
sed -i '1 i\server 10.10.10.11 iburst' /etc/chrony.conf;
sed -i '/#allow/ a\allow 10.10.10.0/24' /etc/chrony.conf;
sed -i '/#local/ a\local stratum 5' /etc/chrony.conf;
cat /etc/chrony.conf;
systemctl restart chronyd && systemctl enable chronyd && systemctl restart chronyd && systemctl status chronyd

OK

你可能感兴趣的:(chrony配置时间源服务:)