22

I've just installed a Fedora 19 on VMware workstation 9. The default network device is "ens33" instead of "eth0" on RHEL.

The reason I have to use "eth0" is that the license component of one of our products has be to be linked with "eth0".

There are some posts discussing about similar issues, most of which are for older OS. I haven't found one that exactly match my situation.

31

The easiest way to restore the old way Kernel/modules/udev rename your ethernet interfaces is supplying these kernel parameters to Fedora 19:

  1. net.ifnames=0
  2. biosdevname=0

To do so follow this steps:

  1. Edit /etc/default/grub
  2. At the end of GRUB_CMDLINE_LINUX line append "net.ifnames=0 biosdevname=0"
  3. Save the file
  4. Type "grub2-mkconfig -o /boot/grub2/grub.cfg"
  5. Type "reboot"

If you didn't supply these parameters during the installation, you will probably need to adjust and/or rename interface files at /etc/sysconfig/network-scripts/ifcfg-*.

Up to Fedora 18, just biosdevname=0 was enough.

As an example, in a certain machine, in a exhaustive research, I got:

-No parameters: NIC identified as "enp5s2".
-Parameter biosdevname=0: NIC identified as "enp5s2".
-Parameter net.ifnames=0: NIC identified as "em1".
-Parameter net.ifnames=0 AND biosdevname=0: NIC identified as "eth0".

  • Thank you very much for the detailed steps! Everything MathWorks was providing me was for much older versions of Fedora. – Dr. Watson Aug 31 '13 at 17:47
  • @dr-watson: Up to Fedora 14, ethX was the default naming for ethernet interfaces. In Fedora 15, the Consistent Network Device Naming was implemented. From Fedora 15 up to 18, just biosdevname=0 was enough to keep ethX naming. You are welcome. – Guilsson Sep 2 '13 at 22:56
  • 3
    This solution also works on Fedora 20. Thanks. – heuristicus Dec 22 '13 at 14:27
  • Also worked on Fedora 21 – Eric Grunzke Dec 18 '14 at 19:25
  • ubuntu 14.04 as well. – sjas Feb 13 '15 at 13:15
9

You can do this using a udev rule, like so:

cat > /etc/udev/rules.d/99-rename-to-eth0.rules << EOF
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$(cat /sys/class/net/ens33/address)", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
EOF
  • Thanks for the example. For others, it's worth noting that the /sys/class/net/ens33 may be different depending on the values returned by the bios and found in the output of lspci -vv | grep -A25 Ethernet. Also, if the intention is to use eth0 as the name then it may be more appropriate to just specify the kernel boot flags to disable the "predictable" naming of the device. – Mark Edington Jan 22 '17 at 9:26
7

In Fedora 20, things seem to have changed a bit further.

1) grub kernel arguments
Yes, both "net.ifnames=0" and "biodevame=0" seem necessary.

2) /etc/sysconfig/network-scripts/ifcfg-ethX
Yes, these are necessary, too.

3) /etc/udev/rules.d/60-net.rules
If you have multiple interfaces and want to control naming of each device rather than letting the kernel do in its own way, /etc/udev/rules.d/60-net.rules seems necessary to override /usr/lib/udev/rules.d/60-net.rules like the following.

# PCI device 0x1011:0x0019 (tulip) {SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:c0:f0:4c:f5:78", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x10ec:0x8168 (r8169) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="60:a4:4c:b5:26:48", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

4) yum remove biosdevname seems unecessary.

  • 1
    Thanks for breaking down the various factors. It seems you have a typo in the #1 point, should be "biosdevname" not "biodevame". – Mark Edington Jan 20 '17 at 12:38
2

This is different in Fedora 19 than in previous releases. There are two things to address:

  1. Remove biosdevname if it is installed. (yum remove biosdevname, or put -biosdevname in your kickstart.
  2. Disable the udev rule: ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

More info can be found at http://fedoraproject.org/wiki/Features/SystemdPredictableNetworkInterfaceNames

2

While the accepted answer does provide a solution that works, it does not explain why ens33 is being used. The links below provide background on why the network device is named something other than eth0 and how it's now named in RHEL 7 variants:

It's also worth noting that the values like "33" that appear in ens33 come from the PCI adapter slot value as returned by the BIOS. Use this command to see what values your system has listed for "Physical Slot":

lspci -vv | grep -A20 Ethernet

Additional information on the "ens" part of the name can be found in the udev source code.

1

For Fedora-24:

  1. Edit /etc/default/grub

  2. At the end of GRUB_CMDLINE_LINUX line append net.ifnames=0 biosdevname=0

  3. Save the file

  4. Type

    grub2-mkconfig -o /boot/grub2/grub.cfg"
    

    or type

    grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
    
  5. Type reboot

  • Why does the network device completely disappear from the system if I apply this method to Fedora 26? ifconfig only returns lo and virbr0, but originally enp4s0 is no longer there. – ajeh Jun 22 '18 at 1:44
  • To answer myself: need to be careful to change all network scripts to be used with ethN naming to use that convention. I had left enp4s0 in one script. – ajeh Jun 22 '18 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.