Chrony时间服务

Chrony服务端配置

#Chrony安装(既可以做服务端,又可以做客户端)
[root@chrony-server ~]# yum -y install chrony

#配置Chrony服务端
[root@chrony-server ~]# cat /etc/chrony.conf | egrep -v "^#|^$"
#配置阿里云的时间同步服务器地址(一个或多个)
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
#允许哪个网段的机器过来同步时间
allow 172.16.1.0/24
#即使同步公网时间失败,也提供授时服务
local stratum 10

#重启Chrony服务
[root@chrony-server ~]# systemctl restart chronyd

Chrony客户端配置

#安装Chrony同步时间的客户端(可以是chronyc也可以是ntpdate)
[root@chrony-client ~]# yum -y install chrony

[root@chrony-client ~]# yum -y install ntpdate

#客户端使用ntpdate进行手动时间同步
[root@chrony-client ~]# ntpdate 172.16.1.128
 7 May 08:12:01 ntpdate[1298]: adjust time server 172.16.1.128 offset -0.021651 sec

#客户端使用Chrony进行手动时间同步
[root@chrony-client ~]# chronyc -a makestep
200 OK

#客户端使用Chrony守护进程的方式进行时间自动化同步

[root@chrony-client ~]# vim /etc/chrony.conf 
#时间同步服务器的地址指向内网地址Chrony的服务端
server 172.16.1.128 iburst

#重启客户端的Chronyd服务
[root@chrony-client ~]# systemctl restart chronyd

#查看时间同步是否正常
[root@chrony-client ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 172.16.1.128                  3   6    37     6   +558ns[+3527us] +/-   19ms

#查看时间同步详细信息
[root@chrony-client ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 172.16.1.128                  3   6    37     9   +558ns[+3527us] +/-   19ms

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值