Problem description
The DNS settings of the instance are reset. Edit /etc/resolv.conf
file to change the DNS server to a non-Alibaba Cloud DNS server. After the server is restarted, the DNS settings are restored to the previous default DNS settings.
Cause
In the CentOS 7 public image, the DNS of etc/resolv.conf
file is generated by executing the script /usr/sbin/dhclient-script
. After the instance is restarted, when the dhclient
initiates a request to obtain the address and other information, the original configuration file /etc/resolv.conf
is reset.
Solution
Alibaba Cloud reminds you that:
- Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
- You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
- If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
Add the DNS server to the file to be modified
, save the configuration, and then restart the server.
Application scope
- ECS
- Simple Application Server