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 (
	root (hd0,0)
	kernel /boot/vmlinuz- ro root=/dev/md0 SYSFONT=latarcyrheb-sun16 KEYTABLE=us biosdevname=0 quiet LANG=en_US.UTF-8
	initrd /boot/initramfs-

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:


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

  • Joe

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

  • Major Hayden

    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. ;)

  • rafha

    hi mayor is totally clean and safe this procedure?

  • Pingback: Links 28/9/2011: Linux 3.1 RC8, Gains for Android Tablets | Techrights()

  • Col Hanzaplast

    That manipulation works like a charm with my virtualbox guest fedora 16.

    Thank you.

  • Jim

    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.

  • Major Hayden

    rafha – I haven’t had any issues with it yet.

    Col & Jim – Really glad I was able to help!

  • Nathan Miller

    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.

  • Lam

    Just want to let you know that it works for me on VirtualBox with installed F17.

    Thank you so much!

  • mhb

    Thank you so much. It works like a charm. No need to change the grub.conf.

  • armando leal

    Podria ayudarme. He seguido sus recomendaciones. Pero yo tengo instalado Fedora 20. Si realiza la asignación. Pero al reiniciar la computadora la asignación cambiaba. EL dispositivo de red que antes era eth0 cambiaba después de reiniciar la computadora. ¿Como le puedo hacer para que asigne un dispositivo sin cambiar después de reiniciar la computadora.?

  • ittech

    thank you a lot . it works very well

  • themelon

    Since they keep changing the game on this one I finally decided to go with the sledgehammer approach.

    Add to kernel boot just in case: “biosdevname=0 net.ifnames=0″

    And because there is a race condition that can happen on driver load making the udev rules not work sometimes I am going the Solaris route of naming the interfaces after the driver name.

    SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”igb”, ATTR{address}==”00:11:22:33:44:10″, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, NAME=”igb0″

    Instead of a wildcard for the DRIVERS attribute use the module name. Another benefit is you no longer care at all what the initial device node name is that udev assigns. It was fun when Fedora 20 would come up with a different order every fresh boot with a new kernel.