How do I Control the Ordering of Network Interfaces?

Andy asked:

I’m attempting to configure a machine with 3 NICs, the first two are built-in GbE controllers, the third is a 10GbE controller. Via NetworkManager, I’ve configured the ‘first’ GbE NIC (which at the time was eth0) to use a static IP address. The second GbE NIC will be configured on a separate private network and the 10GbE NIC is not being used right now.

When I reboot the machine, the ordering of eth0, eth1, eth2, etc appears to be random. Occasionally eth0 will pick up the static ip address, other times it is recognized as eth1 and grabs a DHCP address. In this case, I need to swap the cables before it reconfigures properly.

How can I control the ordering so that a particular physical NIC always comes up as eth0 or eth1 without changing next reboot?

My answer:

The supported way to do this, for RHEL 6 and in the future, is consistent network device naming. This ensures that all interfaces get a meaningful name which is based on the hardware and remains the same throughout the life of the system (if you don’t change the hardware, anyway, and usually even if you do).

(Note that in RHEL 7, a different naming format is used.)

To switch to it, you need to reinstall the system, and when you install, you must pass the kernel command line option biosdevname=1 when starting the installation media, and every time you boot the system.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.