Getting back to using eth0 in Fedora 15

Fedora 15 was released with some updates to allow for consistent network device names. Once it’s installed, you’ll end up with network devices that are named something other than eth0, eth1, and so on.

For example, all onboard ethernet adapters are labeled as emX (em1, em2…) and all PCI ethernet adapters are labeled as pXpX (p[slot]p[port], like p7p1 for port 1 on slot 7). Ethernet devices within Xen virtual machines aren’t adjusted.

This may make sense to people who swap out the chassis on servers regularly and they don’t want to mess with hard-coding MAC addresses in network configuration files. Also, it should give users predictable names even if a running system’s drives are inserted into a newer hardware revision of the same server.

However, I don’t like this on my personal dedicated servers and I prefer to revert back to the old way of doing things. Getting back to eth0 is pretty simple and it only requires a few configuration files to be edited followed by a reboot.

First, add biosdevname=0 to your grub.conf on the kernel line:

title Fedora (2.6.40.4-5.fc15.x86_64)
	root (hd0,0)
	kernel /boot/vmlinuz-2.6.40.4-5.fc15.x86_64 ro root=/dev/md0 SYSFONT=latarcyrheb-sun16 KEYTABLE=us biosdevname=0 quiet LANG=en_US.UTF-8
	initrd /boot/initramfs-2.6.40.4-5.fc15.x86_64.img

Open /etc/udev/rules.d/70-persistent-net.rules in your favorite text editor (create it if it doesn’t exist) and add in the following:

# Be sure to put your MAC addresses in the fields below
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:33:44:10", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:22:33:44:11", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Be sure to rename your ifcfg-* files in /etc/sysconfig/network-scripts/ to match the device names you’ve assigned. Just for good measure, I add in the MAC address in /etc/sysconfig/network-scripts/ifcfg-ethX:

...
HWADDR=00:11:22:33:44:10
...

Reboot the server and you should be back to eth0 and eth1 after a reboot.

Comments

  1. Joe says

    I didn’t even have to reset biosdevname. The 70-persistent-net.rules that I still had from F14 kept mine from changing.

  2. says

    Joe -

    Upgrades from previous versions of Fedora are excluded from the device name updates. It would have been quite a mess if they updated the names during an upgrade. ;)

  3. Jim says

    I was having problems with a license file. The root cause of the problem was the method used to validate the node matching the Mac address. It was looking for a device called eth0 where Fedora 15 was showing em1. Your procedure was a great help in switching the device name back to eth0. Thanks for posting it.

  4. Nathan Miller says

    Have you tried a fresh install of Fedora 17 yet? They changed the game a bit more. 70-persistent-net.rules is no longer created by the /lib/udev/write_net_rules file as the write_net_rules file is no longer there either. So I deleted biosdevname, but I’m guessing it is just a race now to see who comes on line first and get the eth0 – eth4 assignments as I have 5 nic’s.

    Any thoughts and how I should control the interface naming now as it seems Fedora is starting to move a different direction.

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *