chrony 란

chrony 는 NTP(Network Time Protocol) 을 구현한 server/client 로 기존 리눅스의 ntpd 를 대체합니다.


특히 RedHat Enterprise Linux 8 부터는 기본 NTP 제품으로 채택되었습니다.


설치

RHEL 8 에는 기본 설치되어 있고 7과 우분투에서는 다음 명령어로 설치하면 됩니다.

RHEL/CentOS chrony 설치

sudo yum install chrony
BASH

Ubuntu chrony 설치

sudo apt install chrony
BASH


이제 부팅시 자동 구동되도록 설정하고 chrony 서비스를 시작합니다.

sudo systemctl enable chronyd
sudo systemctl start chronyd
CODE


설정


Amazon Linux 에는 chrony 설정이 이미 되어 있으므로 수정할 필요가 없습니다.


chrony 의 설정 파일은 /etc/chrony.conf 입니다. 에디터로 열어서 기존 서버 정보를 주석 처리하고 한국과 아시아를 추가합니다.

/etc/chrony.conf 

# 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 send.mx.cdnetworks.com iburst
CODE


변경 사항을 반영하기 위해 chronyd 를 재구동합니다.

$  sudo systemctl restart chronyd
CODE



동기화 설정이 제대로 되었는지 확인하기 위해 timedatectl 명령을 실행합니다.

# timedatectl 

 Local time: Sat 2020-01-11 17:19:18 KST
  Universal time: Sat 2020-01-11 08:19:18 UTC
        RTC time: Sat 2020-01-11 08:19:18
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
CODE


chronyd 를 콘트롤하는 명령어인 chronyc 로 정상 연결 여부를 확인합니다. 

# 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                 0   6     0     -     +0ns[   +0ns] +/-    0ns
^* send.mx.cdnetworks.com        2   6    17     9  +4376ns[ +135us] +/-   47ms
CODE



같이 보기


참고