Disable consistent network device naming in RHEL7

Latest response

In RHEL6, I simply had to kickstart with 'biosdevname=0' to disable this and fall back to ethX interface naming. In RHEL7, I understand that I need to use net.ifnames=0 in order to do this, but it doesn't retain after installation. I'm looking for the best way to automate disabling consistent network device naming during installation (Kickstart). Any thoughts?

Also, Page 117 in the RHEL7 Networking Guide incorrectly tells me I need to modify /etc/grub.conf.

Josh Baird's picture

Responses

Ok, both biosdevname=0 net.ifnames=0 are required at install time to disable consistent network device naming (which isn't really consistent at all on VMWare).

It looks Josh is satisfied with what he worked out, but I still want to give a more complete response:

You have two options (as described in the new RHEL 7 Networking Guide) to disable the new naming scheme:

  • Run once: ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

OR

  • Run once: echo 'GRUB_CMDLINE_LINUX="net.ifnames=0"' >>/etc/default/grub

Note that the biosdevname package is not installed by default, so unless it gets installed, you don't need to add biosdevname=0 as a kernel argument.

Be careful with the second option. YOu may overwrite system's default parameters.

The file to be edited is /etc/sysconfig/grub and the var GRUB_CMDLINE_LINUX needs to be modified to have the previous options plus "biosdevname=0 net.ifnames=0"

Hello,

ls -l /etc/sysconfig/grub shows there is a symlink: /etc/sysconfig/grub -> /etc/default/grub So editing /etc/default/grub is what is shown in the System Administrator's Guide, for reasons of reliability, here: Customizing GRUB 2 Menu, Editing a Menu Entry

Thank you EDIT: Fix link above and add this as its preferred Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool

Noted!. Thanks for the info.

I am kickstarting a 7.1 build in VMWare Fusion (same happens in ESX) and the "ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules" is apparently ignored. It works using "net.ifnames=0 biosdevname=0" in the append section of the kickstart file though. Why wouldn't the "ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules" work?

Hello Josh

Thank you for reporting this.

I'll investigate and update the guide as necessary.

Thank you

Hello,

I will change the Networking Guide to say "Add the following line to the /etc/default/grub file"

BTW, quote from the Networking Guide "unless the system is a Dell system, or biosdevname is explicitly enabled as described in Section 9.4.2, “Enabling and Disabling the Feature”, the systemd naming scheme will take precedence. "

thank you

Hey Josh - could you give a short explanation or use-case of why you prefer legacy naming for your interfaces? I'm just curious and wondering what other teams have run in to regarding issues. I'm in a Dell shop and I have found the biosdevname to be helpful (since we don't have a consistent hardware layout as well).
Thanks!

Mainly because when using VMWare, the biosdevname makes no sense. It's not consistent at all.

Ah - brilliant! That makes total sense.

Thanks for the insight.

I found this very confusing and documentation misleading as well. On this page: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Consistent_Network_Device_Naming.html it sounds like the way to get back to the kernel naming was to set the biosdevname=1 kernel cmndline option. It turns out you have to set biosdevname=0 and net.ifnames=0 (as above), thought the symlink to /dev/null (also above) does work as well.

We also have a large VM environment where the new-hotness in network interface naming is highly unpredictable, and the old-n-busted kernel naming scheme is actually 100% predictable.

Hello

I am sorry you found the documentation misleading. Note that biosdevname is not enabled by default except on Dell systems, so setting those options on the command line should not be required in your VM case.

I have just read through Disabling Consistent Network Device Naming and I realize now that there needs to be a note to rebuild the grub file. The line "For more information about GRUB2 see Red Hat Enterprise Linux 7 System Administrator's Guide" is not strong enough.

I will send a patch to the guide maintainer.

How do I get this to work with anaconda / kickstart?

I added --append="net.ifnames=0" to the bootloader entry in kickstart and this gets it added to grub, but I still end up with ifcfg-ens192 on the initial build.

Thanks!

Ah ... I just needed to pass net.ifnames=0 on anaconda bootup. "Kernel Options" in RedHat Satellite.

Nice. This the parameter net.ifnames=0 will be reflected in the installed system (RHEL 7.1 +) . See Which boot time parameters from the kickstart file will be reflected in the grub.cfg file on RHEL 7.1

I did this as well but my interface still shows ifcg-enxxxxxxx.

I've added it to the bootloader option as well. Is there anything else you had to do?

Ok. So it starts eth0 but enxxxxxxx is still configured. I had to rename the file and update the name within it, then restart the interface. Is there a way to have it write to eth0?

This is causing us a big headache with auto provisioning viaSatellite kickstarting, it looks like the NIC naming format usingthe grub bootloader method doesn't take effect until the final boot, meaning the network provisioning script writes out old naming formats in network scripts.

Writing a post execute renaming script seems to be the easiest way forward but makes more advanced configurations like dual nic routing far more painful than it needs to be.

Maybe 10 years ago this change would have been useful in the physical space, but in a virtual world I don't see how this is useful.

You need to customize the Kickstart PXEBoot templates in Sat6

Could you share an example of customizing Kickstart PXEBoot templates in Sat6?

This is my EL7 PXE Kickstart PXE template in Foreman/Sat6:

<%#
kind: PXELinux
name: Community Kickstart PXE
oses:
- RedHat 7
%>
default linux
label linux
kernel <%= @kernel %>
<% if @host.operatingsystem.name == "Fedora" and @host.operatingsystem.major.to_i > 16 -%>
append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%> ks.device=bootif network ks.sendmac biosdevname=0 net.ifnames=0
<% else -%>
append initrd=<%= @initrd %> ks=<%= foreman_url("provision")%> ksdevice=bootif network kssendmac biosdevname=0 net.ifnames=0
<% end -%>
IPAPPEND 2

Good Day, I am deploying a RHEL 7.2 VM and having a little trouble getting the ethx names to show up. I appended the following in my kickstart

bootloader --location=mbr --append="net.ifnames=0 biosdevname=0"

After the VM is deployed, the only network connection to show up is the loopback adapter. I know there are benefits for using the new naming on Physical servers, but I would like to use the old name for our Virtual Machines.

What am I missing?

I figured it out. The line for the grub during boot to the automation, I added net.ifnames=0 and that fixed the issue.

Can you tell please what exactly and where did you add to fix that ?

I am trying to prepare RHEL 7.2 installation ISO using kickstart and I have:

bootloader --location=mbr --append="net.ifnames=0"

but after boot and installation process I still get

/etc/sysconfig/network-scripts/ifcfg-eno*

file and not /ifcfg-eth0 which is what I want (I get eth0 device though ...) In addition my the /etc/sysconfig/network-scripts/ifcfg-eno doesn't have the settings I used in bootloader line from kickstart (why ?)

I ran into the same problem, but i also want to rename eth0 to eth1 and eth1 to eth0. After trial and error i have ended up with just solely a udev rule and removing all other suggestions from grub config. udev rule(based on example i found on internet):

cat /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:XX:XX:XX", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:XX:XX:XY", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

On the XX/XY fil lin the correct mac-adresses and create the ifcfg-eth* files.

To make sure it is really persistent i also ran: grubby --update-kernel=ALL reboot dracut -f -v reboot

Works for me, my solution is very different to all solution I see on internet, i do not know why i just only need a udev-rule and nothing else. I wonder if just adding the udev-rule would work for others too?

Was this helpful?

We appreciate your feedback. Leave a comment if you would like to provide more detail.
It looks like we have some work to do. Leave a comment to let us know how we could improve.