— 이강우 2024/09/25 08:28
최근 리눅스 배포판들의 시간동기화(NTP)방식은 예전과 다릅니다.
과거에는 NTP
(ntpd
, ntpdate
) 패키지들을 이용하여 동기화를 했으나 최근에는 chrony
를 이용하는데 이 둘도 아닌 systemd-timesyncd
를 기본으로 사용하는 배포판도 늘어나고 있습니다.
systemd-timesyncd
는 systemd
에 기본으로 포함된 시간 동기화 데몬입니다.
timedatectl status
로 상태를 확인가능하며 System clock synchronized: yes
라고 나타나면 동기화가 작동중입니다.
(venv) [root@r9-director ~]# timedatectl status Local time: Wed 2024-09-25 17:29:57 KST Universal time: Wed 2024-09-25 08:29:57 UTC RTC time: Wed 2024-09-25 08:29:58 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no (venv) [root@r9-director ~]#
기본적인 설정은 /etc/systemd/timesyncd.conf
파일에서 설정할 수 있으나 기본적으로는 모든 값들이 비어있습니다.
설정값이 비어있으면 소스에 지정된 기본 NTP서버들로 동기화를 시도합니다.
journalctl -u systemd-timesyncd
명령어로 현재 동기화 중인 NTP서버와 상태를 확인할 수 있습니다.
root@test-ubuntu:~# journalctl -u systemd-timesyncd Aug 06 06:53:29 koov systemd[1]: Starting Network Time Synchronization... Aug 06 06:53:29 koov systemd[1]: Started Network Time Synchronization. Aug 06 06:53:31 koov systemd-timesyncd[623]: Network configuration changed, trying to establish connection. Aug 06 06:54:02 koov systemd-timesyncd[623]: Network configuration changed, trying to establish connection. Aug 06 06:54:02 koov systemd-timesyncd[623]: Network configuration changed, trying to establish connection. Aug 06 06:54:33 koov systemd-timesyncd[623]: Initial synchronization to time server 185.125.190.57:123 (ntp.ubuntu.com). Aug 06 07:02:59 test-ubuntu systemd[1]: Stopping Network Time Synchronization... Aug 06 07:02:59 test-ubuntu systemd[1]: systemd-timesyncd.service: Deactivated successfully. Aug 06 07:02:59 test-ubuntu systemd[1]: Stopped Network Time Synchronization. -- Boot 2b8f74f04ef54fbf8a75293f8688a329 -- Aug 06 07:03:07 test-ubuntu systemd[1]: Starting Network Time Synchronization... Aug 06 07:03:07 test-ubuntu systemd[1]: Started Network Time Synchronization. Aug 06 07:03:08 test-ubuntu systemd-timesyncd[631]: Network configuration changed, trying to establish connection. Aug 06 07:03:09 test-ubuntu systemd-timesyncd[631]: Network configuration changed, trying to establish connection. Aug 06 07:03:40 test-ubuntu systemd-timesyncd[631]: Initial synchronization to time server 185.125.190.58:123 (ntp.ubuntu.com). Aug 06 08:27:03 test-ubuntu systemd[1]: Stopping Network Time Synchronization... Aug 06 08:27:04 test-ubuntu systemd[1]: systemd-timesyncd.service: Deactivated successfully. Aug 06 08:27:04 test-ubuntu systemd[1]: Stopped Network Time Synchronization. -- Boot 5a4b1cdfcea74a018df6507220ebf39b -- Sep 25 09:01:22 test-ubuntu systemd[1]: Starting Network Time Synchronization... Sep 25 09:01:22 test-ubuntu systemd[1]: Started Network Time Synchronization. Sep 25 09:01:24 test-ubuntu systemd-timesyncd[641]: Network configuration changed, trying to establish connection. Sep 25 09:01:55 test-ubuntu systemd-timesyncd[641]: Network configuration changed, trying to establish connection. Sep 25 09:01:55 test-ubuntu systemd-timesyncd[641]: Network configuration changed, trying to establish connection. Sep 25 09:02:27 test-ubuntu systemd-timesyncd[641]: Initial synchronization to time server 91.189.91.157:123 (ntp.ubuntu.com).
현재 debian/ubuntu
계열의 배포판에서 기본적으로 사용되고 있으며 RedHat
계열은 chrony
를 기본으로 사용합니다.