時刻同期化の設定チェック

Prev Next

VPC環境で利用できます。

NAVERクラウドプラットフォームでは時刻同期化のための NTPサーバを提供します。時刻同期化設定はシステムの運用と管理に重要な影響を及ぼし、セキュリティ、ネットワーク通信、データの正確性などと密接な関係があります。なるべく周期的な1回限りの時刻同期化よりは、持続的に時刻を同期するデーモンの使用をお勧めします。

NAVIX, CentOS, Rocky Linux

NAVERクラウドプラットフォームで提供している RedHat系の OSで NTP設定値とファイルをチェックしてください。

参考

このガイドでサポートする OSは CentOS 7、Rocky Linux 8、Rocky Linux 9です。

  1. chronyインストールおよび動作を確認します。
    • CentOS 7
    [root@centos7 ~]# rpm -qa | grep chrony
    chrony-3.4-1.el7.x86_64
    
    [root@centos7 ~]# ps -ef|grep chronyd | grep -v grep 
    chrony     497     1  0 Mar27 ?        00:00:05 /usr/sbin/chronyd
    
    • Rocky Linux 8
    [root@rockylinux8 ~]# rpm -qa | grep chrony
    chrony-4.1-1.el8.rocky.0.1.x86_64
    
    [root@rockylinux8 ~]# ps -ef | grep chronyd | grep -v grep
    chrony       725       1  0 Jul25 ?        00:00:05 /usr/sbin/chronyd
    
    • NAVIX 9, Rocky Linux 9
    [root@navix9 ~]# rpm -qa | grep chrony
    chrony-4.6.1-1.el9.x86_64
    
    [rootnavix9 ~]# ps -ef | grep chronyd | grep -v grep
    chrony       768       1  0 14:52 ?        00:00:00 /usr/sbin/chronyd -F 2
    
  2. DHCPから取得した NAVERクラウドプラットフォームの NTP設定値を確認します。
    VPC環境で提供される NTPサーバの IPアドレスは 169.254.169.123169.254.169.124です。
    • CentOS 7, Rocky Linux 8
    [root@rockylinux8 ~]# cat /var/lib/dhclient/chrony.servers.eth0
    169.254.169.123 iburst 
    169.254.169.124 iburst
    
    • NAVIX 9, Rocky Linux 9
    [root@naivx9 ~]# cat /run/chrony-dhcp/eth0.sources
    server 169.254.169.123 iburst
    server 169.254.169.124 iburst
    server 169.254.169.123 iburst
    server 169.254.169.124 iburst
    
    もし、上記のファイルに 169.254.169.123169.254.169.124 が存在しない場合は、以下のように直接 NTP設定値を追加して対応できます。
    [root@naivx9 ~]# cat /etc/chrony.conf
    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (https://www.pool.ntp.org/join.html).
    pool navix.pool.ntp.org iburst
    ...省略 ...
    
    [root@naivx9 ~]# systemctl restart chronyd.service
    
    [root@naivx9 ~]# chronyc -n sources
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^? 121.174.142.82                0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 175.195.167.194               0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^* 169.254.169.123               2   6    17    17    +11us[ +185us] +/- 1472us
    ^+ 169.254.169.124               2   6    17    17    +35us[ +208us] +/- 1447us
    
  3. timedatectl コマンドで時刻の同期有無を確認します。
    NTP synchronized 値、または System clock synchronized 値が yesになると同期化が正常に行われた状態です。
    • CentOS 7
    [root@centos7 ~]# timedatectl
                   Local time: Fri 2023-08-18 13:57:57 KST
               Universal time: Fri 2023-08-18 04:57:57 UTC
                     RTC time: Fri 2023-08-18 04:57:57
                    Time zone: Asia/Seoul (KST, +0900)
                  NTP enabled: yes
             NTP synchronized: yes
              RTC in local TZ: no
    
    • NAVIX 9, Rocky Linux 8, Rocky Linux 9
    [root@navix9 ~]# timedatectl
                   Local time: Thu 2025-06-26 18:52:51 KST
               Universal time: Thu 2025-06-26 09:52:51 UTC
                     RTC time: Thu 2025-06-26 09:52:51
                    Time zone: Asia/Seoul (KST, +0900)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
    
  4. /etc/resolv.confファイルの設定と内容を確認します。追加の時刻同期化を設定するか、既存の設定情報を変更したい場合にこのファイルで設定できます。
    VPC環境で提供される NTPサーバの IPアドレスは 169.254.169.123169.254.169.124です。
    • CentOS 7
    [root@centos7 ~]# cat /etc/chrony.conf
    # Use public servers from the pool.ntp.org project.
    server 0.centos.pool.ntp.org iburst
    server 1.centos.pool.ntp.org iburst
    server 2.centos.pool.ntp.org iburst
    server 3.centos.pool.ntp.org iburst
    
    ...省略 ...
    
    • Rocky Linux 8
    [root@rockylinux8 ~]# cat /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.rocky.pool.ntp.org iburst
    ...省略 ...
    
    • NAVIX 9, Rocky Linux 9
    [root@navix9 ~]# cat /etc/chrony.conf 
    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (https://www.pool.ntp.org/join.html).
    pool navix.pool.ntp.org iburst
    ...省略 ...
    
  5. 時間同期化の内容を確認します。
    [root@navix9 ~]# chronyc -n sources -v
    
      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
     / .- Source state '*' = current best, '+' = combined, '-' = not combined,
    | /             'x' = may be in error, '~' = too variable, '?' = unusable.
    ||                                                 .- xxxx [ yyyy ] +/- zzzz
    ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
    ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
    ||                                \     |          |  zzzz = estimated error.
    ||                                 |    |           \
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^? 175.195.167.194               0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 158.247.202.103               0  10     0     -     +0ns[   +0ns] +/-    0ns
    ^? 194.0.5.123                   0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 193.123.243.2                 0  10     0     -     +0ns[   +0ns] +/-    0ns
    ^? 175.210.18.47                 0  10     0     -     +0ns[   +0ns] +/-    0ns
    ^? 121.174.142.81                0  10     0     -     +0ns[   +0ns] +/-    0ns
    ^? 121.174.142.82                0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 203.32.26.46                  0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^+ 169.254.169.123               2   9   377   333   +859us[ +861us] +/- 2367us
    ^* 169.254.169.124               2   8   377   147  +1003us[+1005us] +/- 2174us
    

Ubuntu

NAVERクラウドプラットフォームで提供している Ubuntu系の OSで NTP設定値とファイルをチェックしてください。

参考

このガイドでサポートする OSは Ubuntu 18.04、Ubuntu 20.04です。

  1. systemd-timesyncdデーモンのステータスを確認します。
    systemd-timesyncdデーモンのステータスが enableの場合は、起動時に chronydサービスが起動できません。
    • Ubuntu 18.04
      Ubuntu 18.04は基本的に systemd-timesynd.serviceが enabledステータスです。chronydサービスを正常に使用するために disabled ステータスに変更します。
    root@ubuntu1804:~# systemctl is-enabled systemd-timesyncd.service
    enabled
    
    root@ubuntu1804:~# systemctl disable systemd-timesyncd
    Removed /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.
    
    root@ubuntu1804:~# systemctl stop systemd-timesyncd
    
    root@ubuntu1804:~# systemctl restart chronyd
    
    root@ubuntu1804:~# systemctl is-enabled systemd-timesyncd.service
    disabled
    
    • Ubuntu 20.04 ~ 22.04
    root@ubuntu2204:~# systemctl is-enabled systemd-timesyncd.service
    masked
    
    • Ubuntu 24.04
      Ubuntu 24.04では基本的に systemd-timesyncdパッケージがインストールされていません。
    root@ubuntu2404:~# systemctl list-unit-files | grep systemd-timesyncd | wc -l
    0
    
  2. chronyインストールおよび動作を確認します。
    root@ubuntu2404:~# dpkg -l | grep chrony
    ii  chrony                               4.5-1ubuntu4.2                          amd64        Versatile implementation of the Network Time Protocol
    
    root@ubuntu2404:~# ps -ef | grep chronyd | grep -v grep
    _chrony      734       1  0 14:52 ?        00:00:00 /usr/sbin/chronyd -F 1
    _chrony      737     734  0 14:52 ?        00:00:00 /usr/sbin/chronyd -F 1
    
  3. DHCPから取得した NAVERクラウドプラットフォームの NTP設定値を確認します。VPC環境で提供される NTPサーバの IPアドレスは 169.254.169.123169.254.169.124です。
    • Ubuntu 18.04 ~ 20.04
    root@ubuntu2004:~# cat /var/lib/dhcp/chrony.servers.eth0 
    169.254.169.123 iburst
    169.254.169.124 iburst
    
    • Ubuntu 22.04 ~ 24.04
    root@ubuntu2404:~# cat /run/chrony-dhcp/eth0.sources
    server 169.254.169.123 iburst
    server 169.254.169.124 iburst
    
    もし、上記のファイルに169.254.169.123と169.254.169.124が存在しない場合は、以下のように対応できます。
    root@ubuntu2404:~# cat /etc/chrony/chrony.conf
    ...省略 ...
    # See http://www.pool.ntp.org/join.html for more information.
    pool ntp.ubuntu.com        iburst maxsources 4
    pool 0.ubuntu.pool.ntp.org iburst maxsources 1
    pool 1.ubuntu.pool.ntp.org iburst maxsources 1
    pool 2.ubuntu.pool.ntp.org iburst maxsources 2
    server 169.254.169.123 iburst
    server 169.254.169.124 iburst
    ...省略 ...
    
    root@ubuntu2404:~# systemctl restart chronyd.service
    
    root@ubuntu2404:~# chronyc -n sources
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^? 91.189.91.157                 0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 185.125.190.58                0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 185.125.190.56                0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 185.125.190.57                0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 194.0.5.123                   0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 193.123.243.2                 0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 175.195.167.194               0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^? 121.174.142.81                0   7     0     -     +0ns[   +0ns] +/-    0ns
    ^* 169.254.169.123               2   6    17     6  +7981ns[ +255ns] +/- 1530us
    ^+ 169.254.169.124               2   6    17     7   -550ns[-8276ns] +/- 1546us
    
  4. timedatectl コマンドで時刻の同期有無を確認します。
    System clock synchronized 値が yesになると、同期化が正常に行われた状態です。
    • Ubuntu 18.04
      root@ubuntu1804:~# timedatectl
                            Local time: Wed 2023-08-18 19:33:52 KST
                        Universal time: Wed 2023-08-18 10:33:52 UTC
                              RTC time: Wed 2023-08-18 10:33:53
                             Time zone: Asia/Seoul (KST, +0900)
             System clock synchronized: yes
      systemd-timesyncd.service active: no
                       RTC in local TZ: no
      
    • Ubuntu 20.04 ~ 24.04
      root@ubuntu2404:~# timedatectl
                     Local time: Fri 2025-07-04 15:17:54 KST
                 Universal time: Fri 2025-07-04 06:17:54 UTC
                       RTC time: Fri 2025-07-04 06:17:54
                      Time zone: Asia/Seoul (KST, +0900)
      System clock synchronized: no
                    NTP service: active
                RTC in local TZ: no
      
  5. /etc/chrony/chrony.confファイルの設定と内容を確認します。追加の時刻同期化を設定するか、既存の設定情報を変更したい場合にこのファイルで設定できます。
    VPC環境で提供される NTPサーバの IPアドレスは 169.254.169.123169.254.169.124です。
    root@ubuntu2404:~# cat /etc/chrony/chrony.conf 
    # See http://www.pool.ntp.org/join.html for more information.
    pool ntp.ubuntu.com        iburst maxsources 4
    pool 0.ubuntu.pool.ntp.org iburst maxsources 1
    pool 1.ubuntu.pool.ntp.org iburst maxsources 1
    pool 2.ubuntu.pool.ntp.org iburst maxsources 2
    
    ...省略 ...
    
  6. 時間同期化の内容を確認します。
    root@ubuntu2404:~# chronyc -n sources -v
    
      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
     / .- Source state '*' = current best, '+' = combined, '-' = not combined,
    | /             'x' = may be in error, '~' = too variable, '?' = unusable.
    ||                                                 .- xxxx [ yyyy ] +/- zzzz
    ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
    ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
    ||                                \     |          |  zzzz = estimated error.
    ||                                 |    |           \
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^? 185.125.190.57                0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 185.125.190.58                0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 185.125.190.56                0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 91.189.91.157                 0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 158.247.202.103               0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 194.0.5.123                   0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 121.174.142.82                0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 121.174.142.81                0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 203.32.26.46                  0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^? 175.195.167.194               0   9     0     -     +0ns[   +0ns] +/-    0ns
    ^+ 169.254.169.123               2   7   377   201   +128us[ +128us] +/- 1573us
    ^* 169.254.169.124               2   9   377   256   +946us[ +932us] +/- 2307us
    
    参考

    Ubuntu 24.04で DHCPを通じて提供された NTPサーバ設定が適用されない現象が確認されました。
    そのため、外部通信が不可能な環境(パブリック IPアドレス未保有または NAT未構成)では時間差が発生することがあります。パブリック IPアドレスを保有している場合、または NAT構成環境では、外部の Public Timeサーバと正常に同期されるため、当該現象は発生しません。

    本問題は Ubuntu 24.04 OSの内部エラーとして確認されており、下記スケジュールに従い変更された BaseOSイメージがリリースされる予定です。

    • 2025年11月20日 BaseOSイメージ反映
      ※内部事情により日程は変更される場合があります。

    既に使用中の Ubuntu 24.04のうち、外部との通信ができない VM(パブリック IPアドレスがないか、NAT構成がされていないステータス)では、以下のように対処できます。

    root@ubuntu2404:~# chronyc -n sources -v | grep -e 169.254.169.123 -e 169.254.169.124
    root@ubuntu2404:~#
    
    root@ubuntu2404:~# echo -e "server 169.254.169.123 iburst\nserver 169.254.169.124 iburst" >/etc/chrony/sources.d/navercloud-ntp-server.sources
    
    root@ubuntu2404:~# cat /etc/chrony/sources.d/navercloud-ntp-server.sources
    server 169.254.169.123 iburst
    server 169.254.169.124 iburst
    
    root@ubuntu2404:~# systemctl restart chronyd
    
    root@ubuntu2404:~# chronyc -n sources -v | grep -e 169.254.169.123 -e 169.254.169.124
    ^- 169.254.169.123               2   6    17     0    +28us[  +28us] +/- 1460us
    ^* 169.254.169.124               2   6     7     1  +1923ns[-4830ns] +/- 1613us 
    

NTPに関するよくあるご質問

Q. ネットワークを通じた時刻同期化 NTPサーバの設定は NAVERクラウドが提供する2台のみ設定すればいいですか?

NAVERクラウドで提供する NTPサーバは顧客の多様な環境を考慮して無料で提供するサービスです。
ネットワーク環境が外部にアクセスできる NATやパブリック IPアドレスを持つ環境の場合は、NAVERクラウドで提供する NTPサーバ以外にも外部の Public NTPサーバを3台以上設定することをお勧めします。

NTPサーバを2台のみ設定する場合、2台のうち1台で時刻同期化が正常に行われない状況が発生すると、どのサーバの時刻が正確な時刻を提供しているのか分からなくなる Majority(過半数)問題が発生します。公式 NTP設定ガイドでも最小3台のサーバを推奨しており、一般的に5台のサーバを設定することをお勧めしています。詳細は、公式ホームページをご参照ください。

Private Subnetで NAT設定ができていないため外部ネットワークにアクセスできない場合、Bastionサーバを外部 Public NTPサーバと同期化できるように設定し、そのサーバを含む最小3台以上の NTPサーバを設定することをお勧めします。