Help Center > > FAQs> Network Configurations> DNS and NTP Configurations> How Can I Configure the NTP and DNS Servers for an ECS?

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

Updated at: Mar 17, 2020 GMT+08:00

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 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

      An example is provided as follows:

      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

  2. Configure the DNS server for the ECS.

    1. Log in to the 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

      An example is provided as follows:

      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

For Windows OSs

Take an ECS running Windows 7 OS as an example.

  1. Log in to the ECS as user Administrator.
  2. Enable the local area connection.

    1. In the lower right corner of the taskbar, click the network connection icon.
    2. Click Open Network and Sharing Center.
    3. In the navigation pane on the left, click Change adapter settings.

  3. Configure the DNS server for the ECS.

    1. Double-click Local Area Connection.
    2. Click Properties in the lower left corner, as shown in Figure 1.
      Figure 1 Local area connection
    3. Select Internet Protocol (TCP/IP) and click Properties, as shown in Figure 2.
      Figure 2 Selecting a protocol type
    4. Select Use the following DNS server addresses and set the IP addresses of the DNS servers as prompted, as shown in Figure 3.
      Figure 3 Setting the IP addresses of the DNS servers

  4. Configure the NTP server for the ECS.

    1. Press Win+R to start the Run text box.
    2. Enter regedit and click OK.

      The Registry Editor window is displayed.

    3. Modify the registry entries.
      • In file HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \ NtpClient, set the value of Enabled to 1, indicating that the NTP server is used.
      • In file HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \ NtpServer, set the value of Enabled to 0, indicating that the NTP server is stopped.
      • In file KEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ Parameters, set the value of NtpServer to 192.165.1.35 and that of TYPE to NTP.
      • In HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \ NtpClient, set the value of SpecialPollInterval to 60 and that of Base to Decimal, indicating the clock synchronization cycle is 60s.
      • In file HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ config, set the values of MaxPosPhaseCorrection and MaxNegPhaseCorrection to ffffffff and that of Base to Hexadecimal.
    4. Press Win+R to start the Run text box.
    5. Enter services.msc and click OK.

      The Service window is displayed.

    6. View the service named Windows Time and set the Start Type to Automatic to synchronize time from the NTP server.
    7. Press Win+R to start the Run text box.
    8. Run the following command to restart the Windows Time service:

      net stop w32time

      net start w32time

    9. Manually change the client time to make it different from the server time. One minute later, check whether the client time is the same as the server time. If yes, the time is synchronized.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel