2022
我们一起努力

Centos中安装并使用Chrony具体方法

Chrony是一个开源的自由软件,它能帮助你保持系统时钟与时钟服务器(NTP)同步,因此让你的时间保持精确,Centos中安装并使用Chrony具体方法。

centos8使用chrony作为NTP服务器centos8使用chrony作为NTP服务器

安装

sudo dnf install chrony -y
sudo 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 iburst
server time3.aliyun.com iburst

允许 192.168.1.0/24 内的客户端通过这台服务器获取时间

allow 192.168.1.0/24

配置无误后,重启chrony服务,并配置开机自启动:

systemctl restart chronyd.service
systemctl 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 iburst
server 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

本文来源:www.lxlinux.net/5490.html,若引用不当,请联系修改。

赞(0)
文章名称:《Centos中安装并使用Chrony具体方法》
文章链接:https://www.fzvps.com/160577.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!