udev renamed eth0 to eth1

I moved a hard drive from one computer running Ubuntu 10.04 to another and everything worked fine except the network.

Searching for eth0 in dmesg output, I found “udev renamed eth0 to eth1”.

After some searching, everything made sense. The MAC address of the ethernet card of the new computer is different from the old one, so udev (device manager) considered that a new ethernet card was installed and named it eth1. I still think that it should consider that there wasn’t an eth0, so it should have named the new card eth0 (Interestingly, I didn’t have this problem moving hard drive between two laptops). In any case, there are two possible fixes.

1. Simply edit /etc/network/interface and change all eth0 to eth1. Restart the networking service.


2. Assign the new card to eth0. To do this, edit /etc/udev/rules.d/70-persistent-net.rules. You should find two entries in this file, one for eth0 and one for eth1. Delete the entry for eth0 and change eth1 to eth0 in the entry containing the new MAC address. Don’t edit /etc/network/interface. Reboot.

Contents of /etc/udev/rules.d/70-persistent-net.rules

# 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:0x10bd (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="OLD MAC ADDRESS", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x10c0 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="NEW MAC ADDRESS", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" <- change this 1 to 0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s