eth0 does not exist after system recovery, network devices start at higher number

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6

Issue

  • After system recovery, image deployment or clone network interfaces do not start at eth0.

  • For example: A system with two network interfaces populates eth4 and eth5, but eth0 - eth3 cannot be used.

Resolution

  • To resolve the issue, comment out all the identifiers, or remove them from configuration files entirely.

  • Move the udev rule file aside:

# mkdir /root/tmp-ifcfg-bak/
# mv /etc/udev/rules.d/70-persistent-net.rules /root/tmp-ifcfg-bak/
  • If the old network interface configuration files (ifcfg-ethX) do not apply, move them aside as well.
# mv /etc/sysconfig/network-scripts/ifcfg-eth* /root/tmp-ifcfg-bak/
  • Otherwise to preserve the configuration for any of these devices, such as eth0, simply comment out any UUID/HWADDR lines in each file (or remove the line entirely) by adding the "#" symbol. For example:
HWADDR=9c:8e:99:4e:no:48
becomes
#HWADDR=9c:8e:99:4e:no:48
  • Now simply reboot the system:
# reboot
  • Afterward, confirm the present network interfaces with the following command:
# ip addr

Root Cause

  • eth0 - eth3 were previously used for other interfaces.

  • In this example, the network interfaces on the system begin at eth4 because the system has records of different interfaces for eth0 - eth3. Even with these interfaces no longer present, the system uses the records as a reservation, to preserve configurations in the event they reappear.

  • There are two places where these records exist. The first is the system udev rules, which map devices to names. The relevant file here is /etc/udev/rules.d/70-persistent-net.rules. In this example, the system the file has these entries:

# PCI device 0x14e4:0x1657 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:8e:99:4e:no:48", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x14e4:0x1657 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:8e:99:4e:no:49", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x14e4:0x1657 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:8e:99:4e:no:4a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x14e4:0x1657 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:8e:99:4e:no:4b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
# PCI device 0x8086:0x10d3 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:b3:cc:ec:no:8e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"
# PCI device 0x8086:0x10d3 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:b3:cc:ec:no:8f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"
  • The above udev rule file checks network interfaces for a matching MAC address and assigns them eth0 - eth5 accordingly.

  • The second place is in the individual interface network configuration (ifcfg-ethX) files. For example, an eth0 configuration at /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0
BOOTPROTO=none
NM_CONTROLLED=yes
ONBOOT=yes
IPADDR=192.168.1.9
NETMASK=255.255.255.0
TYPE=Ethernet
UUID="4de29c1b-3e61-4b77-be29-13bb2bno45b9"
DNS1=4.2.2.2
DNS2=8.8.8.8
PREFIX=24
GATEWAY=192.168.1.254
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=9c:8e:99:4e:no:48
LAST_CONNECT=1354642180
USERCTL=no
  • This contains two identifiers, UUID and HWADDR, which ensure this configuration is only applied to a matching interface. The UUID is a universally unique identifier, and would prevent a NIC card with a reconfigured MAC address from matching.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.