본문 바로가기
Operating System/Linux

[Rocky] Linux 시간 동기화 설정 (Chronyd)

by 근육곰돌이 2024. 4. 17.
728x90

Chronyd

개요

  • Linux chrony로 시간 동기화(time synchronizing)
  • CentOS 8이상 버전부터는 rdate를 이용하여 시간동기화가 되지않는다.

 

설치 방법

01. 현재 설정 정보를 확인

timedatectl
#      Local time: 목 2024-04-18 12:38:47 KST
#  Universal time: 목 2024-04-18 03:38:47 UTC
#        RTC time: 수 2024-04-17 07:50:47
#       Time zone: Asia/Seoul (KST, +0900)
#     NTP enabled: yes
#NTP synchronized: no
# RTC in local TZ: no
#      DST active: n/a

 

02. 만일 Time Zone이 잘못 설정되어 있는경우 Time Zone 설정

timedatectl set-timezone Asia/Seoul

 

03. chrony 설치

  • chrony 설치
  • dnf install chrony
  • 우분투일 경우
  • sudo apt install chrony

 

03. chrony configure

vim /etc/chrony.con
# pool 2.centos.pool.ntp.org iburst
server time.bora.net iburst

 

04. 부팅 시 자동 구동 설정

systemctl enable chronyd
systemctl start chronyd

 

05. chronyd 구동 확인 (시작 X)

chronyc sources -v

#   .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
#  / .- Source state '*' = current best, '+' = combined, '-' = not combined,
# | /             'x' = may be in error, '~' = too variable, '?' = unusable.
# ||                                                 .- 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

# ^? 설정 동기화 시작 X
# ^* 설정 동기화 구동

 

06. timedate ntp on

timedatectl set-ntp true
systemctl restart chronyd

 

07. chronyd 구동 확인 (시작 O)

chronyc sources -v

#   .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
#  / .- Source state '*' = current best, '+' = combined, '-' = not combined,
# | /             'x' = may be in error, '~' = too variable, '?' = unusable.
# ||                                                 .- 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                 2   6    17     3  +2539us[+2960us] +/-   84ms


# ^? 설정 동기화 시작 X
# ^* 설정 동기화 구동
timedatectl status
#               Local time: 수 2024-04-17 17:03:23 KST
#           Universal time: 수 2024-04-17 08:03:23 UTC
#                 RTC time: 수 2024-04-17 08:03:23
#                Time zone: Asia/Seoul (KST, +0900)
#System clock synchronized: yes                               <-- 동기화 하고 있음
#              NTP service: active
#          RTC in local TZ: no

 

 

 

참고

https://musclebear.tistory.com/186

 

[Rocky] chronyc settime 설정오류

증상 chronyc 설정 시 아래와 같이 에러가 나올경우 settime 505 Facility not enabled in daemon 조치 2가지 사항을 확인해야한다. 1. /etc/chrony.conf 에 "local stratum 10" 이 설정되어 있는지 / makestep이 설정 되어 있

musclebear.tistory.com

 

반응형