记一次chrony同步失败问题排查

先简单介绍一下chrony

chrony是linux7开始使用的时间同步服务,系统内置。比ntp更加快捷,简单

实际配置中总是出现各种问题,排除时,首先关闭selinux,关闭防火墙。

尝试过多次,最近一次成功的案例是,服务端的配置文件修改了三项

自己是自己的服务器

# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.102.11 iburst

开启同步许可
# Allow NTP client access from local network.
allow 192.168.102.0/24

开启同步层

# Serve time even if not synchronized to a time source.
local stratum 10

保存后,本地重启chronyd服务,客户端也重启chronyd服务。可以自动同步

 

含有服务端和客户端:服务名为 chronyd,客户端工具chronyc

配置文件 /etc/chron.conf

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.102.131 iburst

此项为时间源地址

修改后需要重启服务,然后用chronyc sources -v 查看同步情况

[root@student ~]# 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               
===============================================================================
^? 192.168.102.131               0   8     0     -     +0ns[   +0ns] +/-    0ns

这是服务器不可达,时间未同步的反馈

 

[root@student ~]# 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               
===============================================================================
^* 192.168.102.131               3   6    17    13  +5813ns[ +120us] +/-   41ms

这是正常同步的信息反馈

 

理论上,只要服务安装了,配置文件没错,重启过服务,关闭了selinux和firewalld,网络通,就会很对进行同步,此次却无法进行同步。

结果发现是客户端的chrony版本比服务端的chrony版本高导致,全部更新到最新版本后马上就同步了

 

posted @ 2019-10-09 15:06  年轻的卖油翁  阅读(17153)  评论(0编辑  收藏  举报