Total Pageviews

Wednesday, 22 September 2010

Persistent eth* interface names RHEL5.{1,2,3,4,5}

If you want to create persistent eth names or change the default


1. First you need to find out the MAC address of the devices and look for the attribute,
ATTR{address}==

[root@manuken ~]# udevinfo -a -p /sys/class/net/devxxx

ATTR{address}=="00:24:81:0f:10:ba"

00:24:81:0f:10:ba is devxxx

[root@manuken ~]# udevinfo -a -p /sys/class/net/dev1xx

00:24:81:0f:13:be is dev1xx



2. Now create the file /etc/udev/rules.d/70-persistent-net.rules, with the following parameters


Example options net_1,net_2 or eth4 eth 5

KERNEL=="eth*", ATTR{address}=="00:24:81:0f:10:ba", NAME="eth4"
or
KERNEL=="eth*", ATTR{address}=="00:24:81:0f:10:ba", NAME="net_1"

KERNEL=="eth*", ATTR{address}=="00:24:81:0f:13:be", NAME="eth5"
or
KERNEL=="eth*", ATTR{address}=="00:24:81:0f:13:be", NAME="net_2"



3. Changes have to be reflected also in /etc/sysconfig/ifcfg-devxxx y /etc/sysconfig/ifcfg-dev1xx

a)

/etc/sysconfig/ifcfg-dev20548
DEVICE=eth4
or

DEVICE=net_1

/etc/sysconfig/ifcfg-dev5837
DEVICE=eth5

or

DEVICE=net_2

b) Also you can change the script name

mv /etc/sysconfig/ifcfg-devxxx /etc/sysconfig/ifcfg-eth4
mv /etc/sysconfig/ifcfg-dev1xxx /etc/sysconfig/ifcfg-eth5

or

mv /etc/sysconfig/ifcfg-devxxx /etc/sysconfig/ifcfg-net_1
mv /etc/sysconfig/ifcfg-dev1xxx /etc/sysconfig/ifcfg-net_2


Udev can also be used to retain Network naming after hardware replacement. This time we base the naming decision on PCI ID rather than mac address.

This can be especially useful in case of hardware failure with NIC replacement in the same PCI Lane.


lspci provides the info in this case

Example



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

No comments: