先簡單介紹一下chrony
chrony是linux7開始使用的時間同步服務,系統內置。比ntp更加快捷,簡單
含有服務端和客戶端:服務名為 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版本高導致,全部更新到最新版本后馬上就同步了