CentOS7搭建时间服务器-chrony
2024-08-26 17:39:50
系统:centos7
防火墙:关闭防火墙和selinux
软件:chrony
centos6我们一直用的ntp时间服务器,虽然到CentOS7上也可以装ntp。但是各种问题。所以建议centos7使用chrony同步工具。
服务端配置:
1.安装chrony软件
[root@server ~]# yum install chrony -y
2.修改配置文件
[root@server ~]# vim /etc/chrony.conf
server 0.centos.pool.ntp.org iburst #可以修改ntp的服务器。最好用国内的。
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
allow 172.19.150.0/24 #打开允许同步的IP
阿里ntp的服务器列表
time1.aliyun.com
time2.aliyun.com
time3.aliyun.com
time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.com
3.启动、开机自启动、查看状态、查看同步源
[root@server ~]# systemctl start chronyd
[root@server ~]# systemctl enable chronyd
[root@server ~]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since 一 2018-04-23 11:25:38 CST; 6min ago
[root@server ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* time4.aliyun.com 2 6 17 41 +87us[+1374us] +/- 28ms
客户端配置:
1. 安装chrony
[root@client ~]# yum install chrony -y
2. 修改配置文件
[root@client ~]# 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).
#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
server 172.19.150.105 iburst #添加server
3.启动、开机自启动、查看状态、查看同步源
[root@client ~]# date
Sat Sep 9 00:00:02 CST 2017
[root@client ~]# systemctl start chronyd
[root@client ~]# systemctl enable chronyd
[root@client ~]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2017-09-09 00:00:11 CST; 7 months 13 days ago
Docs: man:chronyd(8)
[root@client ~]# date
Sat Sep 9 00:00:13 CST 2017
[root@client ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 172.19.150.105 3 6 17 3 +52us[ +107us] +/- 32ms
###最后一条有*号表示同步成功
最新文章
- 【单页应用巨坑之History】细数History带给单页应用的噩梦
- http应用优化和加速说明-负载均衡
- MySQL学习笔记——函数
- Gradle学习系列之四——增量式构建
- 我写了本破书-swift语言实战晋级
- 【@ContextConfiguration】java世界的那些注解
- Sphinx 排序模式 SetSortMode
- Swift中出现“no such module cocoa”的错误
- Docker ( Is docker really better than VM ?)
- 学习笔记——备忘录模式Memento
- java虚拟机学习-JVM调优总结(5)
- XGBoost原理和公式推导
- 一种hyperscan API使用(1)
- django-registration
- hdu 2167 方格取数 【状压dp】(经典)
- 一、集合框架(Collection和Collections的区别)
- 伸展树(Splay)复杂度证明
- 远程登录-出现身份验证错误[可能是由于CredSSP加密Oracle修正]
- 解决使用Qt creator时出现Cannot overwrite file ..Permission denied
- 关于ApplicationContext的初始化