Why an Entry Is Automatically Added to /etc/hosts After a Linux ECS Is Restarted?
Symptom
After an ECS is restarted, an entry that maps its host name to 127.0.0.1 is automatically added to /etc/hosts. As a result, the host name fails to be resolved.
Root Cause
/etc/cloud/cloud.cfg affects the following configuration in /etc/hosts:
manage_etc_hosts: localhost
This configuration automatically translates the host names to the local loopback address, which can speed up startup when the private DNS is not configured.
Solution
- Open the /etc/cloud/cloud.cfg file.
Comment out manage_etc_hosts:
Before:
manage_etc_hosts:localhost
After:
#manage_etc_hosts:localhost
2. Delete 127.0.0.1 hostname hostname from /etc/hosts.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot