Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

The method still supported in RHEL 6 is via udev device rules.

There should be an automatically generated /etc/udev/rules.d/70-persistent-net.rules which forces consistent naming:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.

# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:90:1d:d1:30", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x10c9 (igb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:90:1d:d1:31", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

If not you can use a similar syntax with your own MAC addresses to force persistent device naming.

share|improve this 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.

share|improve this answer

As suggested by RedHat documentation you can specify HWADDR=MAC-address parameter in your interface configuration file.

HWADDR=MAC-address where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction with MACADDR.

share|improve this answer

As mentionned by HBruijn, the ordering in rhel6 is /etc/udev/rules.d/70-persistent-net.rules. This file is writen by /lib/udev/write_net_rules.

If for some reason you need an arbitrary and pre-determined ordering of your network interfaces, you may replace this script by your own one, to create the 70-persistent-net.rules file. This makes sure it won't be overwriten.

You may obtain device information to do so using

lspci | grep -i ethernet

to get the list of devices

ethtool -i ethx
ethtool -P ethx

to get the MAC-addr of each one (correlate PCI @ / MAC @).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.