LinuxMoz

Linux Stuff && Coffee

Udev Renamed Network Interface Eth0 to Eth1

| Comments

I recently cloned some Virtual Machines (in VirtualBox) and reset the MAC addresses of the network cards on each of the new cloned machines, as a result eth0 was missing. After inspection of dmesg it found the following udev renamed network interface eth0 to eth1 if you open up the following file you should see something similar to the following:

1
2
3
4
5
6
7
8
9
10
11
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:9c:00:16", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:9c:00:18", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Copy the MAC address from the eth1 line and delete it, amend the MAC on the eth0 line and save the file, it should now look like this.

1
2
# PCI device 0x8086:0x100e (e1000) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:9c:00:18", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Save the file and close it, open /etc/sysconfig/network-scripts/ifcfg-eth0 and correct the HWADDR= entry, save the file and reboot.

Confirm the interface has been assigned an address correctly using ifconfig

I don’t know of a way around this issue so currently I am doing the above on each machine I clone.

Comments