Gentoo에서 systemd & timedatectl 날짜 sync 하기

입질쾌감 물때표

date 커맨드로 확인해 보고 시간이 맞지 않을 경우에는 NTP를 이용해서 시간 동기화를 맞춰야 하는데, systemd를 사용하고 있는 젠투에서는 시간을 맞추기 위해 아래처럼 설정해야 한다.

NPT는?

What is an NTP?
NTP is an abbreviation for Network Time Protocol. It is a standard Internet Protocol (IP) for synchronizing computer clocks over a network.

This protocol synchronizes all networked devices to Coordinated Universal Time (UTC) within a few milliseconds ( 50 milliseconds over the public Internet and under 5 milliseconds in a LAN environment).

# ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
# timedatectl
               Local time: Thu 2023-07-27 20:42:40 KST
           Universal time: Thu 2023-07-27 11:42:40 UTC
                 RTC time: Thu 2023-07-27 20:41:52
                Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
         This mode cannot be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

아마 timedatectl를 치면 위와 같은 메세지를 보게 되는데, 아래처럼 진행하면 NTP 설정이 간단하게 설정된다.

# systemctl status systemd-timesyncd.service
○ systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd-timesyncd.service(8)

# timedatectl set-ntp true

# timedatectl
               Local time: Thu 2023-07-27 20:46:31 KST
           Universal time: Thu 2023-07-27 11:46:31 UTC
                 RTC time: Thu 2023-07-27 11:46:32
                Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

# systemctl enable systemd-timesyncd.service
Created symlink /etc/systemd/system/dbus-org.freedesktop.timesync1.service → /lib/systemd/system/systemd-timesyncd.service.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.
# systemctl start systemd-timesyncd.service
# date
Thu Jul 27 09:47:04 PM KST 2023
# timedatectl
               Local time: Thu 2023-07-27 21:47:16 KST
           Universal time: Thu 2023-07-27 12:47:16 UTC
                 RTC time: Thu 2023-07-27 21:47:16
                Time zone: Asia/Seoul (KST, +0900)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

synchronized 설정되어 있고, NTP 서비스도 활성화 되어 있다. 끝!

답글 남기기

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