网站首页 > 教程文章 正文
Centos8不在直接使用ntp,而是使用chrony作为时间同步,chrony既可以当服务器端广播时间,又可以作为客户端同步时间 |
安装
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
猜你喜欢
- 2025-03-13 Windows电脑使用cmd命令行同步北京时间
- 2025-03-13 云计算openstack共享组件——时间同步服务ntp(2)
- 2025-03-13 告别时间混乱!Linux时间同步服务搭建及常见问题解决方案
- 2025-03-13 NTP服务器地址总结
- 05-11阿里开源MySQL中间件Canal快速入门
- 05-11MyBatis插件开发实战:手写一个分页插件
- 05-11Flask数据库——SQLAlchemy
- 05-11MySQL 到 Hazelcast Cloud 实时数据同步实操分享
- 05-11sqlmap 详解
- 05-11一篇文章让你学会Elasticsearch中的查询
- 05-11Mysql性能优化这5点你知道吗?简单却容易被初学者忽略!
- 05-11Spring Boot 实现 MySQL 读写分离技术
- 最近发表
- 标签列表
-
- location.href (44)
- document.ready (36)
- git checkout -b (34)
- 跃点数 (35)
- 阿里云镜像地址 (33)
- qt qmessagebox (36)
- md5 sha1 (32)
- mybatis plus page (35)
- semaphore 使用详解 (32)
- update from 语句 (32)
- vue @scroll (38)
- 堆栈区别 (33)
- 在线子域名爆破 (32)
- 什么是容器 (33)
- sha1 md5 (33)
- navicat导出数据 (34)
- 阿里云acp考试 (33)
- 阿里云 nacos (34)
- redhat官网下载镜像 (36)
- srs服务器 (33)
- pico开发者 (33)
- https的端口号 (34)
- vscode更改主题 (35)
- 阿里云资源池 (34)
- os.path.join (33)