设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 441|回复: 2
收起左侧

centos8使用chrony作为NTP服务器

[复制链接]
发表于 2021-7-27 05:40:15 | 显示全部楼层 |阅读模式
Centos8不在直接使用ntp,而是使用chrony作为时间同步,chrony既可以当服务器端广播时间,又可以作为客户端同步时间


                               
登录/注册后可看大图

安装
sudo dnf install chrony -ysudo yum install chrony -y

Centos8使用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编辑:倪家兴,审核员:逄增宝


您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-3-29 12:39 , Processed in 0.066602 second(s), 9 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表