Help Center/ Elastic Cloud Server/ Troubleshooting/ Linux ECS Issues/ What Should I Do If the IP Settings of My Linux ECS Are Lost?
Updated on 2024-08-15 GMT+08:00

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.

Figure 1 Symptom

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.

Figure 2 Normal dhclient

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

  1. Remotely log in to the ECS.
  2. Run the following commands to restart NetworkManager and make it automatically start at server startup:

    systemctl restart NetworkManager

    systemctl enable NetworkManager

  3. Run the following command to query the NetworkManager status:

    systemctl status NetworkManager

    Figure 3 Viewing the NetworkManager status
  4. Run the following command to query the network status:

    ip ad

    Figure 4 Viewing the network connection

    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.

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