Help Center/ Elastic Cloud Server/ FAQs/ Network Configuration FAQ/ How Can I Configure the NTP and DNS Servers for an ECS?
Updated on 2024-09-26 GMT+08:00

How Can I Configure the NTP and DNS Servers for an ECS?

For Linux OSs

Take the NTP and DNS servers running SUSE as an example.

  1. Configure the NTP server for the ECS.

    1. Log in to the Linux ECS.
    2. Run the following command to switch to user root:

      sudo su -

    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 or IP address of the NTP server

      Example:

      If the IP address of the NTP server is 192.168.56.1, add the following statement:

      server 192.168.56.1

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

      service ntp restart

    6. Run the following command to check the status of the NTP server:

      service ntp status

      If you want to disable NTP, perform the following steps:

      1. Run the service ntp stop command to stop NTP.
      2. Run the systemctl disable ntp command to disable the function of automatically starting NTP upon ECS startup.

  2. Configure the DNS server for the ECS.

    1. Log in to the Linux ECS.
    2. Run the following command to switch to user root:

      sudo su -

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

      vi /etc/resolv.conf

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

      nameserver = IP addresses of the DNS servers

      Example:

      If the IP addresses of the DNS servers are 8.8.8.8 and 4.4.4.4, add the following statements:

      nameserver = 8.8.8.8

      nameserver = 4.4.4.4

      The IP addresses of the DNS servers must be the same as those in the VPC subnet. Otherwise, the DNS modification cannot persistently take effect.

    5. Run the following command to restart the network:

      rcnetwork restart

      service network restart

      /etc/init.d/network restart