OBSIDIANLAKE

Writing down my thoughts once ince a while

Persistent network interfaces, eth# renaming

with 3 comments

On Ubuntu Linux it seems that the conventional network interface card alias naming used to be done by means of /etc/iftab which is a file read by the program ifrename; because when I changed one of my network cards that was malfunctioning and I found that the new network card didn’t take the old eth# alias, I searched on every Ubuntu documentation resource (forum, wiki, community documentation resources, UDSF — which by the way, was down at that time) but all “fixes” I could find were referring to /etc/iftab.

On Gutsy, and probably on Feisty too, I haven’t checked, that file doesn’t exist, and so doesn’t ifrename. Thanks to my previous experience as a Gentoo user, I remembered about udev rules and naming schemes for network interface cards. Ubuntu uses a persistent naming scheme for each interface detected, thus network cards will always be named in the order they were first detected at installation: eth0 will always be the same NIC, eth1 also and so on.

To fix this, in /etc/udev/rules.d/70-persistent-net.rules you will find all interface mappings. udev can do mappings by means of one or more types of attributes. Here’s how that file looked after I replaced the malfunctioning NIC:

# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="##:##:##:##:##:##", NAME="eth0"

# PCI device 0x11ab:0x4320 (skge)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="##:##:##:##:##:##", NAME="eth2"

# PCI device 0x8086:0x1229 (e100)
# SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="##:##:##:##:##:##", NAME="eth1"

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="##:##:##:##:##:##", NAME="eth1"

As you can see, I commented out the third interface configuration, that was the old NIC that broke using the e100 driver. The new network card was added last to the list by /etc/udev/rules.d/75-persistent-net-generator.rules which generates these entries for each new interface detected. Formerly its NAME attribute was eth3, which isn’t really replacing the old card but adding another one, so I changed it to eth1 because that was the old card’s alias (see the commented lines). Now I hope this helps you.😉

Written by brokenthorn

August 30, 2007 at 18:10

Posted in hardware, Linux, Ubuntu

3 Responses

Subscribe to comments with RSS.

  1. Thanks for the tip. It’s people like you that make me feel I made the right choice by using Ubuntu as the main OS on my laptop.

    As boring and unread as you might think you are, this page was #1 on Google🙂 And I can see why.

    PS: your blog for Romanian users seems to be down atm (01:50 GMT+2).

    Anonymous

    November 15, 2007 at 23:50

  2. Thanks. #1 on Google? hmm…

    Do I know you?🙂

    PS: Romanian blog is running on my PC which is only running from 5 PM to about midnight.

    Paul-Sebastian

    November 16, 2007 at 16:17

  3. No, you don’t know me, but I found your blog post on Google and that helped me fix an issue I had with Gutsy, so thank you for that🙂

    Anonymous

    November 21, 2007 at 09:41


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: