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?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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) DEVICE=eth0 BOOTPROTO=static DHCPCLASS= HWADDR=00:30:48:56:A6:2E IPADDR=10.10.10.15 NETMASK=255.255.255.192 ONBOOT=yes
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"
References
Method 2
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.
Method 3
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0