Help Center> Elastic Cloud Server> FAQs> Network Configurations> DNS and NTP Configurations> Does HUAWEI CLOUD Provide the NTP Server and How Can I Configure It?
Updated on 2023-10-31 GMT+08:00

Does HUAWEI CLOUD Provide the NTP Server and How Can I Configure It?

Yes. HUAWEI CLOUD provides the NTP server, and you can use it only on the ECSs you have purchased on the HUAWEI CLOUD management console.

You can use the Huawei-provided NTP server or other NTP servers. The configuration procedures are the same. This section describes how to configure the Huawei-provided NTP server on an ECS.

ECSs created using x86 public images use chronyd for time synchronization by default. You do not need to configure the NTP server.

Background

If you use the NTP server provided by HUAWEI CLOUD, you also need to use the DNS server. Table 1 lists the NTP servers provided by HUAWEI CLOUD in different regions.

For details about how to obtain the DNS server address, see What Are the Private DNS Server Addresses Provided by Huawei Cloud?

Table 1 NTP servers

Region

NTP Server IP Address

EU-Dublin

ntp.huaweicloud.eu

Linux (chronyd)

The following section uses CentOS 7.3 as an example.

  1. Check whether the IP address of the DNS server is correct on the ECS.

    1. Log in to the Linux ECS.
    2. Run the following command to open the resolv.conf file:

      vi /etc/resolv.conf

    3. Check whether the nameserver value in the file is the same as the IP address of the DNS server provided in Table 1.
      • If yes, go to step 3.
      • If no, go to step 2.

  2. (Optional) Configure the DNS server for the ECS.

    1. Log in to the Linux ECS.
    2. Run the following command to edit the resolv.conf configuration file:

      vi /etc/resolv.conf

    3. Add the following statement to configure the DNS server:

      nameserver IP address of the DNS server

      Example:

      Consider the CN North region as an example. Add the following statement:

      nameserver 100.125.1.250

  3. Configure the NTP server for the ECS.

    1. Log in to the Linux ECS.
    2. Run the following commands to stop the chronyd process:

      systemctl stop chronyd

      systemctl disable chronyd

    3. Run the following command to edit the chrony.conf configuration file:

      vim /etc/chrony.conf

    4. Add the following statement to configure the NTP server:

      server Domain name of the NTP server minpoll 4 maxpoll 10 iburst

      Example:

      server ntp.myhuaweicloud.com minpoll 4 maxpoll 10 iburst

    5. Run the following command to start the NTP service upon system restart:

      For Euler and CentOS:

      systemctl restart chronyd

      For SUSE:

      service chronyd restart

      Run the required command based on the OS running on the ECS.

      If the message "Failed to restart chronyd.service: Unit not found." is displayed, run the yum -y install chrony command.

    6. Run the following command to check whether the time on the NTP server has been synchronized with that on the upper-layer NTP server:

      chronyc sources -v

      If "*" is displayed, the time has been synchronized.

      Figure 1 Modification result

      It takes several minutes to perform NTP time synchronization for the first time.

    7. Set the automatic startup of the NTP service.

      For Euler and CentOS:

      systemctl enable chronyd

      For SUSE:

      chkconfig chronyd on

Linux (ntpd)

The following section uses CentOS 7.3 as an example.

  1. Check whether the IP address of the DNS server is correct on the ECS.

    1. Log in to the Linux ECS.
    2. Run the following command to open the resolv.conf file:

      vi /etc/resolv.conf

    3. Check whether the nameserver value in the file is the same as the IP address of the DNS server provided in Table 1.
      • If yes, go to 3.
      • If no, go to 2.

  2. (Optional) Configure the DNS server for the ECS.

    1. Log in to the Linux ECS.
    2. Run the following command to edit the resolv.conf configuration file:

      vi /etc/resolv.conf

    3. Add the following statement to configure the DNS server:

      nameserver IP address of the DNS server

      Example:

      Consider the CN North region as an example. Add the following statement:

      nameserver 100.125.1.250

  3. Configure the NTP server for the ECS.

    1. Log in to the Linux ECS.
    2. Run the following commands to stop the chronyd process:

      systemctl stop chronyd

      systemctl disable chronyd

    3. Run the following command to edit the ntp.conf configuration file:

      vim /etc/ntp.conf

    4. Add the following statement to configure the NTP server:

      server Domain name of the NTP server

      Example:

      server ntp.myhuaweicloud.com

    5. Run the following command to start the NTP service upon system restart:

      For Euler and CentOS:

      systemctl restart ntpd

      For SUSE:

      service ntpd restart

      Run the required command based on the OS running on the ECS.

      If the message "Failed to restart ntpd.service: Unit not found." is displayed, run the yum -y install ntp command.

    6. Run the following command to check whether the time on the NTP server has been synchronized with that on the upper-layer NTP server:

      ntpq -p

      If "*" is displayed, the time has been synchronized.

      It takes several minutes to perform NTP time synchronization for the first time.

    7. Set the automatic startup of the NTP service.

      For Euler and CentOS:

      chkconfig ntpd on

      For SUSE:

      chkconfig ntpd on

Follow-up Procedure

After the ECS is restarted, the DNS configuration is reset, and its IP address is changed to the IP address of the DNS server in the VPC subnet. Therefore, before restarting the ECS, check whether the DNS configuration in the VPC subnet is the same as the target DNS configuration. If they are different, modify the DNS configuration in the VPC subnet. For details, see Modifying a Subnet.

DNS and NTP Configurations FAQs

more