LinuxProbe 发表于 2021-7-27 05:40:15

centos8使用chrony作为NTP服务器


Centos8不在直接使用ntp,而是使用chrony作为时间同步,chrony既可以当服务器端广播时间,又可以作为客户端同步时间
https://www.linuxprobe.com/wp-content/uploads/2020/10/Snipaste_2020-10-31_18-32-08.png安装
sudo dnf install chrony -ysudo yum install chrony -yCentos8使用firewalld服务对防火墙进行管理。放行ntp服务(123/udp)firewall-cmd --add-service=ntp --permanent && firewall-cmd --reload作为服务器端
配置chrony服务端sudo vim /etc/chrony.conf删除配置自带的NTP服务器。换成国内阿里云的NTP服务器地址。添加上游NTP服务器server time1.aliyun.com iburst   server time2.aliyun.com iburstserver time3.aliyun.com iburst允许 192.168.1.0/24 内的客户端通过这台服务器获取时间allow 192.168.1.0/24 配置无误后,重启chrony服务,并配置开机自启动:systemctl restart chronyd.servicesystemctl enable chronyd.service使用ss -tlunp | grep chrony或者 lsof -i:123命令检查chrony服务使用的123/udp端口是否启动成功作为客户端
同样安装,然后修改客户端chrony配置文件sudo 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).# pool 2.centos.pool.ntp.org iburst #添加NTP服务器server time1.aliyun.com iburst   server time2.aliyun.com iburstserver time3.aliyun.com iburst如果有自建的chrony客户端也可以自行配置server 192.168.1.30 iburst重启chrony客户端服务,重启chrony服务,并配置开机自启动:systemctl restart chronyd.service && systemctl enable chronyd.service --now查看同步状态chronyc sources -v本文原创地址:https://www.linuxprobe.com/centos8-chrony-ntp.html编辑:倪家兴,审核员:逄增宝

thamky 发表于 2021-7-27 10:03:12

{:6_299:}{:6_299:}

kcchan 发表于 2021-7-27 11:23:03

{:6_299:}{:6_299:}{:6_299:}
页: [1]
查看完整版本: centos8使用chrony作为NTP服务器