Present Location: News >> Blog >> Interface Renaming

Blog

> Interface Renaming
Posted by prox, from Charlotte, on May 20, 2006 at 13:59 local (server) time

Ever upgrade your Linux kernel only to find that the two network cards in your NAT/router box swapped names?  Yeah, it's annoying, but there's a couple ways of fixing this on Debian-ish Linux distributions, that enable you to assign interface names via MAC addresses.

The Ubuntu Way

Ubuntu's Dapper release uses /etc/iftab along with udev by default.  You'll find the contents of your /etc/iftab populated upon install, which might look something like this:

# This file assigns persistent names to network interfaces.
# See iftab(5) for syntax.
eth0 mac 00:11:95:29:f1:0a arp 1

This is interpreted by udev by a rule found in /etc/udev/rules.d/25-iftab.rules.  Just edit that file, adding and removing interfaces and their corresponding MAC addresses, and you're good to go.

The Debian ifrename(8) Way

First, apt-get install ifrename.  This will add an /etc/init.d/ifrename script, which runs upon system initialization, reads /etc/iftab.  Just like Ubuntu, you can add interfaces and MAC addresses there.

The Debian udev(8) Way

If you want udev to assign the names on the fly, you don't necessarily need ifrename or an /etc/iftab file, just an addition of a udev rule.  Create the file /etc/udev/rules.d/net.local.rules, and populate it with the following:

KERNEL=="eth*", SYSFS{address}=="00:01:80:50:dc:f2", NAME="wired"
KERNEL=="eth*", SYSFS{address}=="00:0d:61:a1:20:15", NAME="wireless"

Change the MAC addresses and NAME's accordingly, and udev should take care of interface names for you.  Thanks to flamingcow for this information.

> Add Comment

New comments are currently disabled for this entry.