SLES 환경에서 NTP 서버 시간 동기화 및 Slewing 모드(-x) 설정 가이드

SUSE Linux(SLES) 환경에서 SAP를 운영하고 있는데, NTP 데몬이 꺼져 있어 서버 시간이 21분이나 느려져 있었습니다. SAP 엔지니어가 영향도를 우려해 선뜻 진행하지 못하길래 과감하게 시간 동기화를 처리했습니다. 다행히 시간이 뒤처진 상태여서 수월하게 맞출 수 있었지만, 만약 서버 시간이 표준시보다 빨랐다면 데이터 정합성 문제로 인해 운영 중 동기화는 불가능했을 겁니다.

# ntpd 데몬의 상태를 확인합니다. 중지상태에 있기 때문에 시간동기화가 되지 않고 있었습니다.
$ systemctl status ntpd
ntpd.service - NTP Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
  Drop-In: /run/systemd/generator/ntpd.service.d
           └ 50-insserv.conf-$time.conf
   Active: inactive (dead)
     Docs: man:ntpd(1)

# 21분의 시간 차이를 즉시 강제로 동기화시킵니다 (Step sync).
# 시간 오차가 얼마가 나든 상관없이(-g) 1회성으로 시간을 즉시 맞추고(-q) 종료
$ ntpd -gq ntp.server.ip.address
12 Aug 14:47:33 ntpd[26774]: ntpd 4.2.8p12@1.3728-o Wed Oct 17 16:05:35 UTC 2018 (1): Starting
12 Aug 14:47:33 ntpd[26774]: Command line: ntpd -gq ntp.server.ip.address
12 Aug 14:47:33 ntpd[26774]: proto: precision = 0.458 usec (-21)
12 Aug 14:47:33 ntpd[26774]: switching logging to file /var/log/ntp
12 Aug 14:47:33 ntpd[26774]: Listen and drop on 0 v6wildcard [::]:123
12 Aug 14:47:33 ntpd[26774]: Listen and drop on 1 v4wildcard 0.0.0.0:123
12 Aug 14:47:33 ntpd[26774]: Listen normally on 2 lo 127.0.0.1:123
12 Aug 14:47:33 ntpd[26774]: Listen normally on 3 eth0 58.54.160.162:123
12 Aug 14:47:33 ntpd[26774]: Listen normally on 4 lo [::1]:123
12 Aug 14:47:33 ntpd[26774]: Listen normally on 5 eth0 [fe80::fcfc:feff:fe65:9fc6%2]:123
12 Aug 14:47:33 ntpd[26774]: Listening on routing socket on fd #22 for interface updates
12 Aug 15:08:46 ntpd[26774]: ntpd: time set +1265.526707 s
ntpd: time set +1265.526707s

# 당장은 문제없지만, 재부팅 시 21분 뒤로 되돌아갈 수 있으므로 하드웨어 시간(RTC)도 맞춰줍니다.
$ hwclock --systohc
$ hwclock --show
2026-08-12 15:10:26.861702+0900

# /etc/sysconfig/ntp 파일에서 ntpd 기동 옵션(Slewing 모드, 부팅 시 강제 동기화 등)을 설정합니다.
# NTPD_OPTIONS 지시자에 "-x" 옵션을 추가하여 NTP데몬 기동 이후 시간이 점진적으로 맞춰지도록(Slewing 모드) 설정합니다.
# Slewing 모드의 진짜 가치는 뒤로 되돌려야 하는데 step이 위험할 때, 서비스를 멈추지 않고 처리하는 수단입니다.
$ cp /etc/sysconfig/ntp /etc/sysconfig/ntp.bak.$(date +%F)
$ vi /etc/sysconfig/ntp
NTPD_OPTIONS="-x -g -u ntp:ntp"
NTPD_FORCE_SYNC_ON_STARTUP="yes"
NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP="yes"

# /etc/ntp.conf 파일에 NTP서버를 등록합니다.
$ cp /etc/ntp.conf /etc/ntp.conf.bak.$(date +%F)
$ vi /etc/ntp.conf
server ntp.server.ip.address iburst prefer

# ntpd데몬을 자동시작 옵션으로 기동시키고 Active 상태를 확인합니다.
$ systemctl enable --now ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
$ systemctl is-active ntpd
active

# NTP서버 이름 앞에 "*"가 있는지 확인합니다.
$ ntpq -p
     remote                   refid      st t when poll reach   delay   offset  jitter
======================================================================================
*ntp.server.ip.address  211.108.117.211  3 u    1   64    1    0.204    0.124   0.049

You may also like...

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다