What controls Red Hat Enterprise's ethN device names

March 8, 2008

Since I just went digging for this the other day, here's what I know about what controls what Ethernet devices get named on Red Hat Enteprise (and probably also on Fedora, but I haven't looked at my Fedora systems in this level of detail).

  • if kudzu is enabled, it uses /etc/sysconfig/hwconf to name everything. If there is no such file or the data in it doesn't match current reality, various bad things happen.

    (You can probably hand-edit the file if necessary.)

  • otherwise, interface naming is controlled by the HWADDR setting in the ifcfg-* files in /etc/sysconfig/network-scripts. If there is no Ethernet address specified, you get no renaming.

The ifcfg files are used by both udev and the ifup scripts that actually bring interfaces up and so on. When udev detects a new network device (including at boot, I believe), it runs /lib/udev/rename_device, which searches the ifcfg-* files for a HWADDR that matches the new device and uses the DEVICE setting from that file to give a name to the new interface.

(A network device that is hotplugged after system boot also winds up running /etc/sysconfig/network-scripts/net.hotplug.)

During boot, the order of operation is udev first, then kudzu, and finally the network init script winds up ifup'ing all of the interfaces that are supposed to be running, potentially undoing any damage kudzu did (if kudzu left the ifcfg configuration files along, which is unlikely).

(You may gather that I have a pretty low opinion of kudzu; in fact, I have been turning it off on most of my systems for years. It was left enabled on this RHEL system mostly because I hadn't taken the time to audit what init scripts were getting run.)


Comments on this page:

From 89.97.255.133 at 2008-09-24 06:52:19:

You can also give a name other than eth* to network interfaces.
Suppose you administer a firewall machine with a number of ethernet interfaces. You can name it int0, dmz0, net0, vpn0 instead of eth0, eth1, eth2, eth3. So when you use "ifconfig" or when you configure your firewall scripts you utilize intuitive names.

To do this you simply have to (from the console):
1) launch the command "/etc/init.d/network stop";
2) change the file names in /etc/sysconfig/network-scripts directory (example: ifcfg-eth0 become ifcfg-vpn0);
3) change the line DEVICE=eth* inside previous files to match file name (example: DEVICE=eth0 in file ifcfg-vpn0 become DEVICE=vpn0);
4) start the network or reboot.

Bye

By cks at 2008-09-29 00:14:49:

As far as I know, you can't rename network interfaces without specifying the hardware address of the interface (ie, there is no way to tell RHEL to automatically rename eth0 to int0 on boot; you can only specify that the interface with Ethernet address whatever should be int0).

From 89.97.255.133 at 2008-10-13 08:57:01:

Of course you can't.

Because udev needs mac address to locate the right device.

But in ifcfg-eth* files, you already have mac addresses (HWADDRESS= line), so when you rename it into ifcfg-whatever and chnge the DEVICE=eth* line to read DEVICE=whatever, udev knows that the interface with that mac address must be named "whatever".

Cheers

Written on 08 March 2008.
« My problem with Ethernet naming on Red Hat Enterprise 5
The difference between a SAN and a cluster filesystem »

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

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