티스토리 뷰

___리눅스

[리눅스] chrony 설치 및 설정(ntpd 대체)

변군 변군이글루 2020. 11. 16. 21:58

chrony 설치 및 설정

 

chrony 설치

$ yum install -y chrony

 

chrony 서비스 활성화 및 서비스 기동

###서비스 활성화(enable) 및 서비스 시작(start)
$ systemctl --now enable chronyd


###서비스 활성화(enable) 및 서비스 시작(start)
$ systemctl enable chronyd
$ systemctl start chronyd

 

chrony.conf 편집

- time.bora.net 추가

- times.postech.ac.kr 추가

$ 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 time.bora.net iburst
server times.postech.ac.kr iburst

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

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

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

 

서비스 재기동

$ systemctl restart chronyd

 

서비스 확인

ntp 소스 서버 상태 확인

$ chronyc sourcestats -v
210 Number of sources = 2
                             .- Number of sample points in measurement set.
                            /    .- Number of residual runs with same sign.
                           |    /    .- Length of measurement set (time).
                           |   |    /      .- Est. clock freq error (ppm).
                           |   |   |      /           .- Est. error in freq.
                           |   |   |     |           /         .- Est. offset.
                           |   |   |     |          |          |   On the -.
                           |   |   |     |          |          |   samples. \
                           |   |   |     |          |          |             |
Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
==============================================================================
time.bora.net               9   5   327     -0.836      7.884    -47us   448us
121.125.77.167              0   0     0     +0.000   2000.000     +0ns  4000ms

 

시간 동기화 상태 확인

$ chronyc sources -v         
210 Number of sources = 2

  .-- 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               
===============================================================================
^* time.bora.net                 3   6   377    11    +99us[  +75us] +/-   33ms
^? 121.125.77.167                0   8     0     -     +0ns[   +0ns] +/-    0ns

 

###동기화 명령
$ chronyc -a makestep
200 OK


###tracking
$ chronyc tracking  
Reference ID    : CBF8F08C (time.bora.net)
Stratum         : 4
Ref time (UTC)  : Mon Nov 16 12:45:16 2020
System time     : 0.081910394 seconds slow of NTP time
Last offset     : -0.000361153 seconds
RMS offset      : 0.000361153 seconds
Frequency       : 17.039 ppm slow
Residual freq   : -102.455 ppm
Skew            : 0.066 ppm
Root delay      : 0.025002619 seconds
Root dispersion : 0.016522199 seconds
Update interval : 1.9 seconds
Leap status     : Normal

 

 

댓글
댓글쓰기 폼