What Should I Do If the IP Settings of My Linux ECS Are Lost?
Symptom
When an ECS has been running continuously for a long time without being restarted, the IP address settings may be lost, ECSs may be disconnected, or the network may break down.
Possible Causes
The ECSs use Dynamic Host Configuration Protocol (DHCP).
For example, when an ECS running CentOS 7 is started, the NetworkManager service of the Linux OS starts the dhclient process. The dhclient requests the DHCP server to allocate an IP address and obtains the IP address lease expiration time.
In normal cases, the dhclient periodically updates the lease expiration time to the DHCP server to ensure the availability of the IP address.
If the NetworkManager service is stopped by mistake and the dhclient process is cleared, the lease expiration time of the DHCP-assigned IP address cannot be automatically updated. When the lease expires, the IP address of the ECS is released, leading to network disconnection.
Solution
- Remotely log in to the ECS.
- Run the following commands to restart NetworkManager and make it automatically start at server startup:
systemctl restart NetworkManager
systemctl enable NetworkManager
- Run the following command to query the NetworkManager status:
systemctl status NetworkManager
Figure 3 Viewing the NetworkManager status
- Run the following command to query the network status:
If information similar to Figure 4 is displayed, the network connection is normal.
Appendix
You are advised to retain the default network service configurations of common OSs.
OS |
Network Service |
Built-In DHCP |
---|---|---|
CentOS 6 |
Network |
No. There is an independent dhclient process. |
CentOS 7 |
NetworkManager |
No. There is an independent dhclient process. |
CentOS 8 |
NetworkManager |
Yes |
Ubuntu 16.04 |
NetworkManager |
No. There is an independent dhclient process. |
Ubuntu 18.04 |
NetworkManager |
No. There is an independent dhclient process. |
Ubuntu 20.04 |
NetworkManager |
Yes |
Ubuntu 22.04 |
NetworkManager |
Yes |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.