Check time sync settings
    • PDF

    Check time sync settings

    • PDF

    Article Summary

    Available in VPC

    NAVER Cloud Platform provides an NTP server for time synchronization. Time sync settings have significant effects on system operation and management and are closely related to security, network communication, data accuracy, etc. It is recommended to use a daemon that synchronizes the time continuously rather than performs one-time synchronization periodically.

    CentOS, Rocky Linux

    Inspect the NTP settings and file in the RedHat OS provided on NAVER Cloud Platform.

    Note

    Described for CentOS 7 and Rocky Linux 8.

    1. Check whether chrony is installed and running.

      • 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
        
    2. Check the NTP settings of NAVER Cloud Platform received from DHCP. The IPs of the NTP server provided in the VPC environment are 169.254.169.123 and 169.254.169.124.

      [root@centos7 ~]# cat /var/lib/dhclient/chrony.servers.eth0
      169.254.169.123 iburst
      169.254.169.124 iburst
      
      • If the directory does not contain 169.254.169.123 and 169.254.169.124, you can add the NTP settings yourself as follows:
        [root@centos7 ~]# 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).
        #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
        server 169.254.169.123
        server 169.254.169.124
        
        ... Omitted...
        
        [root@centos7 ~]# systemctl restart chronyd.service
        
        [root@centos7 ~]# chronyc sources
        210 Number of sources = 2
        MS Name/IP address         Stratum Poll Reach LastRx Last sample              
        ===============================================================================
        ^? 169.254.169.123               3   6     3     6  -1689us[-1689us] +/-   48ms
        ^? 169.254.169.124               3   6     3     6  -1437us[-1437us] +/-   38ms
        
    3. Check whether time has been synchronized using the timedatectl command.

      • If the NTP synchronized value or System clock synchronized value is yes, time has been synchronized successfully.
      • 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
        
      • Rocky Linux 8
        [root@rockylinux8 ~]# 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)
          System clock synchronized: yes
                        NTP service: active
                    RTC in local TZ: no
        
    4. Check the settings and content of the /etc/chrony.conf file. Change the settings of this file to add new time sync settings or change the existing settings.

      • The IPs of the NTP server provided in the VPC environment are 169.254.169.123 and 169.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
        
        ... Omitted...
        
      • Rocky Linux 8
        • In the time sync settings, annotate the incorrectly inserted 10.X IP band.
        • Since server information for time synchronization is received from the DHCP server, time synchronization is not affected even if you do not make this change.
        • Before annotation
          [root@rockylinux8 ~]#  cat /etc/chrony.conf
          # These servers were defined in the installation:
          server 10.22.64.22 iburst
          server 10.22.64.38 iburst
          # Use public servers from the pool.ntp.org project.
          # Please consider joining the pool (http://www.pool.ntp.org/join.html).
          
          ... Omitted...
          
        • After annotation
          [root@rockylinux8 ~]#  cat /etc/chrony.conf
          # These servers were defined in the installation:
          # server 10.22.64.22 iburst
          # server 10.22.64.38 iburst
          # Use public servers from the pool.ntp.org project.
          # Please consider joining the pool (http://www.pool.ntp.org/join.html).
          server 169.254.169.123
          server 169.254.169.124
          
          ... Omitted...
          
    5. Check the time sync content.

      [root@centos7 ~]# systemctl restart chronyd.service
      
      [root@centos7 ~]# chronyc sources -v
      
      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
      / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
      | /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
      ||                                                 .- 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              
      ===============================================================================
      ^+ 169.254.169.123               3   6   377    14  +3999us[+3999us] +/-  227ms
      ^+ 169.254.169.124               3   6   377    51   +198us[ +198us] +/-   44ms
      
      

    Ubuntu

    Inspect the NTP settings and file in your Ubuntu OS provided on NAVER Cloud Platform.

    Note

    Described for Ubuntu 18.04 and Ubuntu 20.04.

    1. Check the status of systemd-timesyncd daemon.

      • If systemd-timesyncd daemon is enabled, the chronyd service does not operate upon booting. Make sure to disable the daemon.
      • Ubuntu 18.04: systemd-timesynd.service is enabled by default. To use the chronyd service normally, disable this setting.
      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
        root@ubuntu2004:~# systemctl is-enabled systemd-timesyncd.service
        masked
        
    2. Check whether chrony is installed and running.

      • Ubuntu 18.04
        root@ubuntu1804:~# dpkg -l | grep chrony
        ii  chrony                                 3.2-4ubuntu4.5                                     amd64        Versatile implementation of the Network Time Protocol  
        
        root@ubuntu1804:~# ps -ef | grep chronyd | grep -v grep
        _chrony   2149     1  0 19:27 ?        00:00:00 /usr/sbin/chronyd
        
      • Ubuntu 20.04
        root@ubuntu2004:~# dpkg -l | grep chrony
        ii  chrony                               3.5-6ubuntu6.2                        amd64        Versatile implementation of the Network Time Protocol  
        
        root@ubuntu2004:~# ps -ef | grep chronyd | grep -v grep
        _chrony      680       1  0 17:48 ?        00:00:00 /usr/sbin/chronyd -F -1
        _chrony      683     680  0 17:48 ?        00:00:00 /usr/sbin/chronyd -F -1
        
    3. Check the NTP settings of NAVER Cloud Platform received from DHCP. The IPs of the NTP server provided in the VPC environment are 169.254.169.123 and 169.254.169.124.

      root@ubuntu2004:~# cat /var/lib/dhcp/chrony.servers.eth0
      169.254.169.123 iburst
      169.254.169.124 iburst
      
      • If the directory does not contain 169.254.169.123 and 169.254.169.124, you can add the NTP settings yourself as follows:
        root@ubuntu2004:~# 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
        server 169.254.169.124
        
        ... Omitted...
        
        root@ubuntu2004:~# systemctl restart chronyd.service
        
        root@ubuntu2004:~# chronyc sources
        210 Number of sources = 2
        MS Name/IP address         Stratum Poll Reach LastRx Last sample              
        ===============================================================================
        ^? 169.254.169.123               3   6     1     8   +608us[ +608us] +/-   19ms
        ^? 169.254.169.124               3   6     1     8   +669us[ +669us] +/-   20ms
        
    4. Check whether time has been synchronized using the timedatectl command.

      • If the value System clock synchronized value is yes, time has been synchronized successfully.
      • 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
        root@ubuntu2004:~# timedatectl
                       Local time: Wed 2023-08-18 17:40:33 KST
                   Universal time: Wed 2023-08-18 08:40:33 UTC
                         RTC time: Wed 2023-08-18 08:40:34   
                        Time zone: Asia/Seoul (KST, +0900)   
        System clock synchronized: yes                       
                      NTP service: active                    
                  RTC in local TZ: no
        
    5. Check the settings and content of the /etc/chrony/chrony.conf file. Change the settings of this file to add new time sync settings or change the existing settings.

      • The IPs of the NTP server provided in the VPC environment are 169.254.169.123 and 169.254.169.124.
        root@ubuntu2004:~# cat /etc/chrony/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
        
        ... Omitted...
        
    6. Check the time sync content.

      root@ubuntu2004:~# chronyc sources -v
      
       .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
      / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
      | /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
      ||                                                 .- 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              
      ===============================================================================
      ^+ 169.254.169.123               3   6   377    14  +3999us[+3999us] +/-  227ms
      ^+ 169.254.169.124               3   6   377    51   +198us[ +198us] +/-   44ms
      

    Q: Do I only need to set up two NTP servers provided by NAVER Cloud for time synchronization via network?

    NAVER Cloud provides NTP servers for free, considering the diverse environments used by customers.
    If your network environment enables external access via NAT or public IP, it is recommended to set up at least three external public NTP servers in addition to NAVER Cloud NTP servers.

    If you set up only two NTP servers and synchronization fails on one of them, it may lead to a majority problem where it becomes unclear which server is providing the accurate time. The official NTP configuration guide also recommends a minimum of three servers and five servers in general. For more information, see Official website.

    If your private subnet without the NAT settings blocks access to the external network, it is recommended to set up at least three NTP servers, including a Bastion server configured to synchronize with external public NTP servers.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.