Skip to main content

Configure time synchronization with an external NTP server

Last update:

Configuring time synchronization via the NTP protocol is required when you prepare your own ISO image for use with the cloud platform.

In pre-built images of cloud servers, all necessary settings for NTP synchronization are already configured.

  1. Check the installed utility.

  2. Configure the utility.

1. Check the installed utility

  1. Connect to the server via SSH.

  2. Check which utility is used on the server:

    systemctl status ntp
    systemctl status chronyd
    systemctl status systemd-timesyncd

    We recommend using Chrony, but you can configure the utility that is already installed on the server.

  3. If you want to switch to Chrony, disable and remove the systemd-timesyncd and ntpd utilities and install Chrony:

    systemctl disable <name>
    sudo apt remove <name>
    sudo apt-get install chronyd

    Specify <name> — the name of the utility to remove (ntp or systemd-timesyncd).

2. Configure the utility

  1. Start Chrony:

    systemctl start chronyd
  2. Open the Chrony configuration file in the vi:

    vi /etc/chrony/chrony.conf
  3. Add or replace the NTP servers in the file. We recommend replacing the servers in the file with Selectel NTP servers, but you can specify any available NTP servers.

    server <ntp_server> iburst

    Specify <ntp_server> — the domain name or IP address of the NTP server.

    If you need to specify multiple servers, list each on a separate line, for example:

    server 0.spb.ntp.selectel.ru iburst
    server 1.spb.ntp.selectel.ru iburst
  4. Exit the vi text editor with your changes saved:

    :wq
  5. Restart the Chrony:

    sudo systemctl restart chronyd
  6. Check the list of NTP servers in use:

    chronyc -N sources