My problem with Ethernet naming on Red Hat Enterprise 5

March 8, 2008

Here's my problem: I have a bunch of identical 1U servers (SunFire X2100 M2s) with four onboard Ethernet ports, driven by two different chipsets (two nVidia ones, two Broadcom ones). I want to configure our RHEL installs so that no matter which physical unit I stuff the system disks into, the Ethernet ports come up with consistent names that match the ports on the back of the server; eth0 should always be the port labeled 'port 0' and so on.

(Since they have hotswap drive bays, we want to be able to easily swap drives between units in case of hardware failure or the like. It also simplifies general administration a bunch if the Ethernet naming matches the hardware naming.)

In the good old days, this was simple; just set up /etc/modprobe.conf to alias eth0 and eth1 to the tg3 driver and eth1 and eth2 to the forcedeth driver, and everything usually worked.

In the new world of udev, not so much; much like with Ubuntu, everything really wants to name things based on known Ethernet addresses, and there seems to be no way to control what order modules are loaded in. The furthest I've gotten is a configuration that does nothing with any 'new' Ethernet ports, so you have to log in on the console and change all of the HWADDR values in the ifcfg files to have the correct Ethernet addresses.

(To do this, you have to turn off kudzu with 'chkconfig --del kudzu'. If you leave it enabled, it will helpfully configure any 'new' Ethernet ports to do DHCP on boot, and in the process it will replace your working ifcfg files with new ones. Yes, it leaves the old files around with .bak extensions, but I am pretty sure that if you swap hardware twice you will lose them entirely.)


Comments on this page:

From 144.32.126.16 at 2008-03-08 04:58:48:

If you're lucky, there might be a convenient equivalent of /dev/disk/by-path.

-- Alan

By cks at 2008-03-08 15:40:29:

I can't spot anything in my searches so far. I think that part of the problem is that network devices can only have one name, unlike disks, so there is no good way to create an equivalent of /dev/disk/by-path. (Disks can easily have multiple names because each name is just a file, but network devices have no native filesystem presence.)

The information is there if I want to write scripts to create the right names (in sysfs, among other places), but I am not certain that I want to be swimming upstream that hard.

From 12.160.193.35 at 2008-03-24 13:45:23:

Worst case you can use ip to rename the devices after install.
ip link set <dev> name <newdevname>
For example, to swap eth0 and eth1 I used the following commands:
ip link set eth0 name eth3 (eth3 is just a temporary name)
ip link set eth1 name eth0
ip link set eth3 name eth1

I am sure there is an easier way, but this was the most permanent way that I could find

Charles Bancroft Software Engineer ITT-IST

From 88.151.27.234 at 2012-02-23 08:53:03:

Hi Chris,

just found your blog from 2008, we have a similar situation where we have lots of replicated servers and we would like to be able to swap discs, the problem we have is that the modprobe.conf seems to be different across machines which have the same hardware, i.e broadcom and nvidia drivers are not always allocated to the same port so I am wondering if it will still work if we make the modprobe.conf and the ethx files the same for all machines?

Sheila Doyle

By cks at 2012-02-23 11:29:41:

I'm afraid that I don't know. Note that the ifcfg-ethX files normally have the hardware Ethernet address of that particular Ethernet port and I believe they get ignored if the actual hardware address is different. Since Ethernet addresses will differ even on machines with identical hardware, you'll need to do something about this.

Written on 08 March 2008.
« Software RAID, udev, and failed disks
What controls Red Hat Enterprise's ethN device names »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Mar 8 00:13:38 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.