• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Did you find what you needed?
    Show your support and gratitude by making a contribution!!
    Life always offers you a second chance ... Its called tomorrow !!!

    Sunday, September 03, 2017

    How to disable consistent network device naming in Red Hat Linux 7

    With Red Hat Enterprise Linux 7 they have introduced a network device naming scheme wherein it provides methods for consistent and predictable network device naming for network interfaces. These features change the name of network interfaces on a system in order to make locating and differentiating the interfaces easier.

    Although in many case we prefer to stick to the traditional naming scheme wherein the interface name would be eth[0123…]. By default on a RHEL 7 node the consistent network device naming would be enabled but if you wish to disable the same there are couple of method.

    This naming scheme is enabled via deifferent set of rules using udev and/or biosdevname depending upon the kernel parameter which is enabled on your system. biosdevname is disabled by default on all hardware except DELL, if you wish to enable biosdevname then you have to explicitly ad biosdevname=1 in your kernel command line parameter.

    IMPORTANT NOTE: Red Hat strongly recommends to use the Consistent Network Device Naming. At boot time (or whenever a network driver is loaded) interfaces are always assigned ethX style names by the kernel, where X is the lowest currently unused number starting with 0 (zero). The kernel has no ability to ensure drivers or interfaces are presented in the same order every time. Because of this, every time the system boots, it is necessary that some OS function ensure a given interface is always assigned the same name, so renaming of interfaces will be seen during the boot process. In RHEL 7, this OS function is provided by systemd's Predictable Network Interface feature.

    Without the Predictable Network Interface feature, network interfaces will be left with their original ethX style names. However, there will be no OS function ensuring specific interfaces are always given the same ethX style name at boot time, so device naming becomes unpredictable. Subsequent boots may have the same interface being given a different ethX name which can cause any number of problems.
    To disable the consistent network device naming
    # ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2:
    enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:b7:6e:24 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.5/24 brd 192.168.1.255 scope global dynamic enp0s3
           valid_lft 86256sec preferred_lft 86256sec
        inet6 fe80::a00:27ff:feb7:6e24/64 scope link
           valid_lft forever preferred_lft forever

    # vim /etc/default/grub
    GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet net.ifnames=0"

    # grub2-mkconfig -o /boot/grub2/grub.cfg
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
    Found linux image: /boot/vmlinuz-0-rescue-d6e5b9fa407542fcbcaa72e7e6b777e2
    Found initrd image: /boot/initramfs-0-rescue-d6e5b9fa407542fcbcaa72e7e6b777e2.img
    done

    Reboot your node for the changes to take affect.
    # ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2:
    eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:b7:6e:24 brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.6/24 brd 192.168.1.255 scope global dynamic eth0
           valid_lft 86390sec preferred_lft 86390sec
        inet 192.168.1.5/24 brd 192.168.1.255 scope global secondary dynamic eth0
           valid_lft 86389sec preferred_lft 86389sec
        inet6 fe80::a00:27ff:feb7:6e24/64 scope link
           valid_lft forever preferred_lft forever

    If your node also has biosdevname enabled then you will also have to disable this to be able to use traditional interface name, this can be done by adding biosdevname=0 in the GRUB_CMDLINE_LINUX
    # vim /etc/default/grub
    GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet net.ifnames=0 biosdevname=0"

    # grub2-mkconfig -o /boot/grub2/grub.cfg
    Reboot your node for the changes to take affect.

    How to disable Consistent Network Device Naming on kickstart?

    To disable this on kickstart you have to workon below two config files

    1. Modify "bootloader" section in kickstart.conf
    2. Modify the default.cfg of the tftp cfg file

    In the kickstart file look out for section with bootloader (if not add a new line)
    bootloader --location=mbr --append="net.ifnames=0 biosdevname=0"
    Append below on the TFTP config file (The pxelinux.cfg file name may be different for your case)
    # vim /var/lib/tftp/linux-install/pxelinux.cfg
    default autoinst

    label autoinst
            IPAPPEND 2
            kernel rhel7_64/vmlinuz
            append initrd=rhel7_64/initrd.img ramdisk_size=65536  vga=no ksdevice=bootif ks=nfs:10.43.138.1:/myfile/kickstart.conf linux edd=off
    net.ifnames=0 biosdevname=0

    This will make sure when the IP is assigned to the interface via initrd, the interface is created with eth0 and the kickstart file will make sure once the node is installed all the interfaces on your target node will have ethX naming convention

    I hope the article was useful.

    References:
    Red Hat 7: Consistent Network Device Naming

    Related Articles:
    Sample kickstart configuration file for RHEL/Centos 7
    How to make IO disk scheduler change reboot persistent in Linux
    How to do Ethernet/NIC bonding/teaming in Red Hat Linux
    Sample kickstart configuration file for RHEL/Centos 7


    Follow the below links for more tutorials

    How to find the path of any command in Linux
    How to configure a Clustered Samba share using ctdb in Red Hat Cluster
    How to delete an iscsi-target from openfiler and Linux
    How to perform a local ssh port forwarding in Linux
    How to use yum locally without internet connection using cache?
    What is umask and how to change the default value permanently?
    Understanding Partition Scheme MBR vs GPT
    How does a successful or failed login process works in Linux
    How to find all the process accessing a file in Linux
    How to exclude multiple directories from du command in Linux
    How to configure autofs in Linux and what are its advantages?
    How to resize software raid partition in Linux
    How to configure Software RAID 1 mirroring in Linux
    How to prevent a command from getting stored in history in Linux

    0 comments:

    Post a Comment