Help Center/ Elastic Cloud Server/ Troubleshooting/ Configuring the Network/ How Do I Fix a Network Startup Failure Due to Multiple NIC Configuration Files?
Updated on 2023-03-30 GMT+08:00

How Do I Fix a Network Startup Failure Due to Multiple NIC Configuration Files?

Symptom

Error message "Device eth1 does not seem to be present" or "No suitable device found for this connection" is displayed after the network is started or restarted.

Figure 1 Network startup failure

Scenarios

The following procedures apply to ECSs running CentOS, RHEL, or EulerOS.

Constraints

The solution described in this section involves restarting the NICs, which will temporarily interrupt the network connection.

Root Cause

When the network service is started, the system reads the NIC configuration file in the /etc/sysconfig/network-scripts/ directory. If there are multiple NIC configuration files, the network service fails to be started because the corresponding NIC cannot be found.

Solution

Back up unnecessary NIC configuration files and delete them from /etc/sysconfig/network-scripts/. The following uses an ECS with 11 NIC configuration files as an example.

  1. Run the following command to access the directory where the NIC configuration files reside:

    cd /etc/sysconfig/network-scripts

  2. Run the following commands to back up the configuration files:

    mkdir tmp

    cp ifcfg-* tmp/

    ls tmp/

    Figure 2 Viewing NIC configuration files
  3. If only one NIC is needed, delete unnecessary NIC configuration files and file ifcfg-ens5 if it exists.

    Run the following command to delete files from ifcfg-eth1 to ifcfg-eth11 and ifcfg-ens5.

    rm -rf ifcfg-eth[1-9] ifcfg-eth10 ifcfg-eth11 ifcfg-ens5

    Figure 3 Deleting unnecessary configuration files
  4. Stop unnecessary dhclient processes.
    1. Run the following command to query dhclient processes.

      ps -ef | grep dhclient

    2. For example, run the following command to end process with PID of 770.

      kill-9 770

      • Enter the PID of the process you want to end.
      • The kill-9 command is used to forcibly end a process.
      Figure 4 Restarting dhclient
  5. Run the following command to restart the network service:

    systemctl restart network

  6. Check the status of the network service.

    systemctl status network

    Figure 5 Checking the network status