CentOS7搭建时间服务器-chrony

 

 

系统: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 ###最后一条有*号表示同步成功

转载于:https://www.cnblogs.com/cheyunhua/p/11427899.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值