WTH: eth0 got renamed to eth2 after an upgrade

While upgrading a remote server from sarge to etch including the new kernel, the server did not come up. After attaching a console (thanks Hetzner!) I found out that the network interface got mysteriously renamed to eth2!

After snooping around a bit, I found out that the culprit was udev, more specifically /etc/udev/rules.d/z25_persistent-net.rules which says:

 # This file was automatically generated by the /lib/udev/write_net_rules
 # program, probably run by the persistent-net-generator.rules rules file. 
 #
 # You can modify it, as long as you keep each rule on a single line.
 # MAC addresses must be written in lowercase.
 # PCI device 0x1106:0x3065 (via-rhine)
 SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0c:76:af:2f:9d", NAME="eth0"

It also contained two entries for bogus eth0 and eth1 (usb dongle got identified as a network card?). After removing the and relabeling interfaces everything is back to normal now.

4 Responses to “WTH: eth0 got renamed to eth2 after an upgrade”

  1. Mikael Hallendal Says:

    Thanks a lot for this post!

    Google pointed me here and it was exactly what I needed to solve my problem. In my case it had found my old /etc/iftab and converted that to eth0, eth1 in the persistent-net file and later added the same network cards again as eth2 and eth3 as well.

    (it seems the script that checks if a specific network card exists in that file is case dependent on the MAC address)

  2. cleaner reviews Says:

    Thanks for sharing.

  3. roman@wlan Says:

    Does my mac adresse change if I upgrade my computer with some other hardware? For example change the graphic card?

  4. Zhabba Says:

    Thanks a lot! You save my evening :)

Leave a Reply