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.
- Configure the NTP server for the ECS.
- Log in to the Linux ECS.
- Run the following command to switch to user root:
sudo su -
- Run the following command to edit the ntp.conf configuration file:
vim /etc/ntp.conf
- 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
- Run the following command to start the NTP service upon system restart:
- Run the following command to check the status of the NTP server:
If you want to disable NTP, perform the following steps:
- Run the service ntp stop command to stop NTP.
- Run the systemctl disable ntp command to disable the function of automatically starting NTP upon ECS startup.
- Configure the DNS server for the ECS.
- Log in to the Linux ECS.
- Run the following command to switch to user root:
sudo su -
- Run the following command to edit the resolv.conf configuration file:
vi /etc/resolv.conf
- 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.
- Run the following command to restart the network:
service network restart
/etc/init.d/network restart
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.