Keep Oracle VM server ethX name consistent across reboot

Jephe Wu - http://linuxtechres.blogspot.com

Problem: random assigned ethX name with MAC address and renamed ethX to something else, different /etc/issue output after each reboot

Environment: Oracle VM server 3.1.1, PCI card with multiple NIC ports


Steps:

1. use DRAC and lspci to check pci bus info

Open DRAC, network device, check each MAC address for NIC


2. draw network diagram for each NIC MAC address


3. assign ethX to pci slot 

create 99-ethernet.rules under /etc/udev/rules.d as follows:


KERNEL=="eth*", ID=="0000:05:05.0", NAME="eth0"
KERNEL=="eth*", ID=="0000:0b:00.0", NAME="eth1"

Note: The ID can be determined by running lspci | grep Eth and prefixing the appropriate number with 0000: or else by using ethtool -i <DEVICE> | grep bus-info.

If using udev rules like this in RHEL5, kudzu should be disabled (chkconfig kudzu off) so that it does not interfere by modifying the /etc/sysconfig/network-scripts/ifcfg-* files.

4. remove HWADDR from ifcfg-ethX

cd /etc/sysconfig/network-scripts/
for i in ifcfg-eth*;do sed -i 's#HWADDR#\#HWADDR#g' $i;done

5. use real driver in /etc/modprobe.conf

cd /etc/
vi modprobe.conf to use correct kernel driver for ethX

ethtool -i eth0
or lspci -vvv 0000:04:00.0

Reference

RHEL5: How to make NIC names persistent across reboots

https://access.redhat.com/site/solutions/16411