1. 程式人生 > >Chrony時間服務器

Chrony時間服務器

|| interval service lock ESS 配置 ima 令行 ==

簡介

chrony是網絡時間協議(NTP)的通用實現,chrony中包含兩個程序,chronyd是一個可以在啟動時啟動的守護程序,chronyc是一個命令行界面程序。

配置文件:chrony.conf
server:時間服務器地址;
allow :允許客戶端;
deny :拒絕客戶端;;
local stratum 10:即使自己未能同步網絡時間,也允許授時給其它客戶端;

環境

CentOS Linux release 7.6
server: 10.120.123.8
client : 10.120.123.9

安裝Chrony

yum install -y chrony

server端(10.120.123.8)

配置文件

vim/etc/chrony.conf
allow 10.120.123.0/24

啟動服務

systemctl start chronyd.service
systemctl enable chronyd.service  

查看端口

netstat -nlup | grep chronyd 
udp        0      0 0.0.0.0:123             0.0.0.0:*                           9091/chronyd        
udp        0      0 127.0.0.1:323         0.0.0.0:*                           9091/chronyd        
udp6      0      0 ::1:323                     :::*                                   9091/chronyd     

client端(10.120.123.9)

配置文件

vim/etc/chrony.conf
server 10.120.123.8 iburst
#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

啟動服務

systemctl start chronyd.service
systemctl enable chronyd.service  

查看同步狀態

1,chronyc sourcestats
210 Number of sources = 1
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
10.120.123.8                0   0     0     +0.000   2000.000     +0ns  4000ms
2.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               
===============================================================================

Chrony時間服務器