본문 바로가기
🐧 Linux_이야기

[Linux] 시간 동기화(Time Sync)

by gwon_s 2026. 2. 5.

시간 동기화

  • 서버 시간이 표준 시간(NTP 서버) 과 맞도록 자동 보정
  • chrony 사용

1️⃣ 현재 시간 상태 확인

🔹 시스템 시간 / 하드웨어 시간

date		# 시스템 시간
Wed Jan 21 22:27:04 KST 2026

 

hwclock		# 하드웨어 시간
2026-01-21 08:37:53.896552+09:00

 

🔹 동기화 상태 확인

timedatectl
               Local time: Wed 2026-01-21 22:27:24 KST	# 실제 서버가 사용하는 시간
           Universal time: Wed 2026-01-21 13:27:24 UTC	# 표준시
                 RTC time: Tue 2026-01-20 23:37:24		# 하드웨어(BIOS) 시계
                Time zone: Asia/Seoul (KST, +0900)		# 현재 서버에 설정된 로컬존
System clock synchronized: no		# NTP와 시간 동기화 여부
              NTP service: inactive		# NTP 서비스 상태 
          RTC in local TZ: no		# RTC → UTC → Local time 변환 여부
  • NTP(Network Time Protocol) : 서버 시간이 틀어지지 않게 맞춰주는 서비스

2️⃣ chrony 사용 여부 확인 (RHEL / Oracle Linux 기준)

🔹chrony 설치 및 버전 확인

rpm -qa | grep chrony
chrony-4.2-1.0.1.el8.x86_64

 

🔹 chrony 상태 확인

systemctl status chronyd
● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:chronyd(8)
           man:chrony.conf(5)

 

3️⃣ chrony 서비스 활성화 및 동기화

🔹 chrony 서비스 시작

systemctl start chronyd
systemctl enable chronyd

 

🔹 chrony 상태 확인

● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2026-01-21 23:00:20 KST; 2 weeks 0 days ago
     Docs: man:chronyd(8)
           man:chrony.conf(5)
 Main PID: 5811 (chronyd)
    Tasks: 1 (limit: 18642)
   Memory: 2.1M
   CGroup: /system.slice/chronyd.service
           └─5811 /usr/sbin/chronyd

Jan 21 23:00:20 ora-act systemd[1]: Starting NTP client/server...
Jan 21 23:00:20 ora-act chronyd[5811]: chronyd version 4.2 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER>
Jan 21 23:00:20 ora-act chronyd[5811]: Using right/UTC timezone to obtain leap second data
Jan 21 23:00:20 ora-act systemd[1]: Started NTP client/server.
Jan 21 23:00:26 ora-act chronyd[5811]: Selected source 221.151.118.78 (2.pool.ntp.org)
Jan 21 23:00:26 ora-act chronyd[5811]: System clock wrong by 1257630.158487 seconds
Feb 05 12:20:57 ora-act chronyd[5811]: System clock was stepped by 1257630.158487 seconds
Feb 05 12:20:57 ora-act chronyd[5811]: System clock TAI offset set to 37 seconds

 

🔹즉시 동기화

chronyc makestep

 

4️⃣ NTP 서버 설정 확인

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).
pool 2.pool.ntp.org 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

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

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

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

 

☝️위 결과는 로컬에서 기본 OS 설치 및 인터넷 연결 환경에서의 결과값

 

만약 회사 내부 NTP 서버가 있을 시 

pool 2.pool.ntp.org iburst
👉 이 한 줄이 아래 서버를 “대신”하고 있음
server 192.168.0.10 iburst