Ethernet Device Names in CentOS 7
I’ve got quite a few servers currently running CentOS 6 that will over the course of the coming months be upgraded to CentOS 7. One of the allures of Linux distributions in the Red Hat family—including CentOS and Fedora—is the kickstart feature, which allows you to automate highly customized installations.
One problem I’m encountering is the CentOS 7 default of using so-called predictable network interface names. No longer can you assume the presence of
eth0; your first interface may be
eno1, or something wackier like
enp4s0f0. This causes issues in kickstart files which refer to a specific interface.
If your system is already running CentOS 6, you’re in luck. The
biosdevname utility (supplied by an RPM of the same name) will tell you how an ethernet device will be named in the new system.
[root ~]# biosdevname -i eth0 em1 [root ~]# biosdevname -i eth1 em2 [root ~]# biosdevname -i eth2 p6p1 [root ~]# biosdevname -i eth3 p6p2
In the case of the CentOS 6 system with those four ethernet devices, I used kickstart to configure
eth2 with a static IPv4 address and jumbo frames. Now I have the information necessary to adjust the CentOS 7 kickstart file:
%post # configure storage network interface cat <<__eof__ > /etc/sysconfig/network-scripts/ifcfg-p6p1 DEVICE="p6p1" NM_CONTROLLED="no" ONBOOT="yes" IPADDR="10.11.12.13" NETMASK="255.255.255.0" MTU="9000" __eof__ %end