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