We have a RHEL 5.5 box with 8 interfaces. And the eth interface naming is flip flopping. Sometimes eth0 comes up on physical port 7th, and sometimes on another physical port.

We want the naming to be as per the sequence of PCI BUS. I did the research and found that

cat /sys/devices/pci0000\:00/0000\:00\:1e.0/0000\:07\:07.0/net\:eth0/address\

This locations have the mac address of the eth devices. So If I get "address" in sequence from this pci bus locations and put them in ifconfig-eth0 to ifconfig-eth7 in order of PCI BUS location, my eth naming will be stable.

I tried:

find /sys/devices/ -name "address"

but it does not bring any results. I don't know why…

Any help here?


Have you tried including the MAC addresses in the different ifcfg-ethX files for the various ethernet devices? Additionally you can control which device get's which ethX handle through udev's 60-net.rules file.

For example

# /etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)

Then in the file /etc/udev/rules.d/60-net.rules:

KERNEL=="eth*", SYSFS{address}=="00:30:48:56:A6:2E", NAME="eth0"

I believe this information is used to keep the devices configured consistently from boot to boot.

Configuring more than one ethX device

To deal with more devices simply setup each devices corresponding /etc/sysconfig/network-scripts/ifcfg-ethX file, and add another line to the 60-net.rules file.

KERNEL=="eth*", SYSFS{address}=="00:30:48:56:A6:2E", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="00:30:48:56:A6:2F", NAME="eth1"

The above is how you do it in CentOS 5.X. The file changes in CentOS 6.x to 70-persistent-net.rules, and the format is slightly different too:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="54:52:00:ff:ff:dd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"



So far as I know , you need a relatively new release. RHEL 6 seems to support this (Consistent Network Device Naming) though it does need to be specifically enabled on most systems. Fedora 15+ also does this, and, by Fedora 17, it seems to be the default mode.

I don't know exactly when this change was completely adopted and, more important to this question, if there is any way to backport this to the RHEL 5 series. This is a start, at least.

  • Two addendums: RHEL6 does the persistent naming via udev rule (in /etc/udev/rules.d/70-persistent-net.rules) so doing so in RHEL5 shouldn't be too hard. Also, the Fedora method is a little different in that it uses a deterministic algorithm when naming interfaces that is different than the eth* naming convention. – Bratchley May 11 '13 at 14:45

You should get hardware address by:

ifconfig -a | grep HWaddr

Or perhaps:

tail -v /sys/devices/*/*/net/eth*/address
# or
tail -v /sys/devices/*/*/*/net/eth*/address

find should have matched.

Also check:

cat /etc/udev/rules.d/70-persistent-net.rules

Se comments below.

  • 2
    70-persistent-net.rules doesn't exist in CentOS/RHEL 5.X. It's new in CentOS/RHEL6.x. – slm May 11 '13 at 14:57
  • @slm: Nothing to test on here, but are you sure? Ref: adminlinux.org/2010/09/persistent-eth-interface-names.html – Runium May 11 '13 at 16:49
  • 1
    The name 70-persistent-net.rules isn't really special so you could use it, adding 5.x syntax udev lines to it, but I have several dozen 5.x and 6.x and it's not on any of the 5.x boxes. Additionally there are scripts and such on the box that typically manage these files so I would expect that none of this would occur using non-standard locations on 5.x vs. 6.x. – slm May 11 '13 at 17:01
  • I went through 5.5 up to 5.8 and none of them have 70-persistent-net.rules either. Looking for a pre 5.5 but I'm going to expect that they wouldn't have it either at this point. – slm May 11 '13 at 17:11
  • @slm: Thanks again. I have to start brushing up on CentOS and RHEL. RHEL 3 was a long time ago. After that it was a long period for me with only Microsoft servers :( – Runium May 11 '13 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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