NTP 설정 및 운영 주의점

리눅스 ntpd(혹은 chrony)와 timesyncd 같이 쓰지 말 것

결론부터 말하면, 시간 동기화 데몬은 서버에 한 개만 실행 중이어야 한다.

추가내용: 서버 시간 동기화: 제발 21세기엔 rdate 쓰지 말자

systemd를 사용하는 리눅스 서버의 시간 동기화를 설명하는 인터넷의 여러 글 중에 ntpd(혹은 chrony) 설치와 함께 timesyncd 를 같이 활성화하라는 내용이 여럿 있다.

# timedatectl
Local time: 금 2020-06-19 00:34:37 KST
Universal time: 목 2020-06-18 15:34:37 UTC
RTC time: 목 2020-06-18 15:34:37
Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
NTP service: inactive
RTC in local TZ: no

위 명령 실행 결과에서 NTP Service 항목이 active 로 나와야 한다는건데, timedatectl 에서 말하는 NTP Service 는 ‘systemd-timesyncd’ 이다. timedatectl set-ntp on 한 뒤에 확인해보라.

# timedatectl set-ntp on
# timedatectl 
Local time: 금 2020-06-19 00:39:24 KST
Universal time: 목 2020-06-18 15:39:24 UTC
RTC time: 목 2020-06-18 15:39:24
Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
# systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor p>
Active: active (running) since Fri 2020-06-19 00:39:20 KST; 35s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 588613 (systemd-timesyn)
Status: "Initial synchronization to time server 211.233.40.78:123 (0.arch.pool.ntp.o>
Tasks: 2 (limit: 9414)
Memory: 1.8M
CGroup: /system.slice/systemd-timesyncd.service
└─588613 /usr/lib/systemd/systemd-timesyncd
6월 19 00:39:20 Arch systemd[1]: Starting Network Time Synchronization…
6월 19 00:39:20 Arch systemd[1]: Started Network Time Synchronization.
6월 19 00:39:21 Arch systemd-timesyncd[588613]: Initial synchronization to time server

한 시스템에 두 개 이상의 시간 동기화 데몬이 실행되면 서버 시간이 널뛰기 할 수 있다.

참고로 systemd-timesyncd 는 SNTP 구현체로 NTP 클라이언트 역할만 함. 2020 년 현재 NTP 구현체 중 chrony 쓰는게 가장 낫다.


NTP 는 시간 동기화 자주 한다고 정밀도가 높아지지 않는다

NTP 를 1 분마다 실행한다고 오차가 작아지지 않는다. 오히려 반복 실행 시 뒤에 실행되는 동기화 명령은 무시된다.

https://serverfault.com/questions/378133/how-to-configure-ntpd-to-sync-time-more-frequently

게시됨

카테고리

작성자

태그:

댓글

“NTP 설정 및 운영 주의점” 에 하나의 답글

답글 남기기

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

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