Configure Time Sync (Chrony) on CentOS 7

Chrony 를 이용한 시간 동기화 가이드

Chrony 는 시간 동기화를 위한 패키지 입니다. 리눅스에서 시간 동기화를 할때 NTP 를 이용하는 것이 일반적이었지만 Rhel 7 부터는 기본 패키지가 NTP 에서 Chrony 로 변경되었습니다.

구성 목표

1. timezone 은 Asia/Seoul로 설정
2. 외부 타임서버는 time.bora.net 를 메인으로 구성하고, time.google.com 을 보조로 등록

현재 timezone 설정 확인

[root@172-16-11-7 /]# timedatectl
      Local time: Thu 2019-01-03 10:30:23 KST
  Universal time: Thu 2019-01-03 01:30:23 UTC
        RTC time: Thu 2019-01-03 01:10:46
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

timezone list 확인

[root@172-16-11-7 /]# timedatectl list-timezones

timezone 설정

[root@172-16-11-7 /]# timedatectl set-timezone Asia/Seoul

chrony 설치

[root@172-16-11-7 /]# yum install -y chrony

chrony 설정
: vi /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 time.bora.net iburst
server time.google.com 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

systemd 데몬 등록 및 재시작

[root@172-16-11-7 /]# systemctl enable chronyd
[root@172-16-11-7 /]# systemctl restart chronyd

시간 동기화 실행

[root@172-16-11-7 /]# timedatectl set-ntp true

확인

[root@172-16-11-7 /]# timedatectl
      Local time: Thu 2019-01-03 10:51:11 KST
  Universal time: Thu 2019-01-03 01:51:11 UTC
        RTC time: Thu 2019-01-03 01:31:40
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

[root@172-16-11-7 /]# chronyc sources
210 Number of sources = 2
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* time.bora.net                 3   6   177    57  +3569us[+3316us] +/-   40ms
^+ time2.google.com              1   6   177    56  -4572us[-4572us] +/-   43ms

[root@172-16-11-7 /]# chronyc tracking
Reference ID    : CBF8F08C (time.bora.net)
Stratum         : 4
Ref time (UTC)  : Thu Jan 03 01:53:12 2019
System time     : 0.000247355 seconds slow of NTP time
Last offset     : -0.000252764 seconds
RMS offset      : 0.007350641 seconds
Frequency       : 20.539 ppm slow
Residual freq   : +8.213 ppm
Skew            : 40.230 ppm
Root delay      : 0.002380613 seconds
Root dispersion : 0.040031828 seconds
Update interval : 64.7 seconds
Leap status     : Normal

You may also like...

Subscribe
Notify of
guest

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x