8.9. Disabling Consistent Network Device Naming

To disable consistent network device naming, is only recommended for special scenarios. See Chapter 8, Consistent Network Device Naming and Section 8.10, “Troubleshooting Network Device Naming” for more information.
To disable consistent network device naming, choose from one of the following:
  • Disable the assignment of fixed names by "masking" udev's rule file for the default policy. This can be done by creating a symbolic link to /dev/null. As a result, unpredictable kernel names will be used. As root, enter the following command:
    ~]# ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
  • Create your own manual naming scheme, for example by naming your interfaces internet0, dmz0 or lan0. To do that, create your own udev rules file and set the NAME property for the devices. Make sure to order the new file above the default policy file, for example by naming it /etc/udev/rules.d/70-my-net-names.rules.
  • Alter the default policy file to pick a different naming scheme, for example to name all interfaces after their MAC address by default. As root, copy the default policy file as follows:
    ~]# cp /usr/lib/udev/rules.d/80-net-name-slot.rules /etc/udev/rules.d/80-net-name-slot.rules
    Edit the file in the /etc/udev/rules.d/ directory and change the lines as necessary.
  • Open the /etc/default/grub/ file and find the GRUB_CMDLINE_LINUX variable.

    Note

    GRUB_CMDLINE_LINUX is a variable that includes entries which are added to the kernel command line. It might already contain additional configuration depending on your system settings.
    Add both net.ifnames=0 and biosdevname=0 as kernel parameter values to the GRUB_CMDLINE_LINUX variable:
      ~]# cat /etc/default/grub
        GRUB_TIMEOUT=5
        GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
        GRUB_DEFAULT=saved
        GRUB_DISABLE_SUBMENU=true
        GRUB_TERMINAL_OUTPUT="console"
        GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel_7/swap rd.luks.uuid=luks-cc387312-6da6-469a-8e49-b40cd58ad67a crashkernel=auto  vconsole.keymap=us vconsole.font=latarcyrheb-sun16 rd.lvm.lv=rhel_7/root rhgb quiet net.ifnames=0 biosdevname=0"
        GRUB_DISABLE_RECOVERY="true"
    
    Rebuild the /boot/grub2/grub.cfg/ file by running the grub2-mkconfig command:
      ~]# grub2-mkconfig -o /boot/grub2/grub.cfg/

    Note

    For systems booted using UEFI:
    ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
    View the current device name. For example, eno1:
    ~]# nmcli connection show
    NAME   UUID                                  TYPE            DEVICE
    Wired  63cba8b2-60f7-4317-bc80-949e800a23cb  802-3-ethernet  eno1
    
    Modify the device name to eth0, and reboot the system:
    ~]# nmcli connection modify Wired connection.interface-name eth0
    
    ~]# reboot
    
    The grubby utility is used for updating and displaying information about the configuration files for the grub boot loader. See the grubby(8) man page for more details. For more information about working with GRUB 2, see the Red Hat Enterprise Linux System Administrator's Guide.