Persistent network interfaces, eth# renaming
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. ;)




5 comments:
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).
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.
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 :)
Thank you for a very useful post.
In my opinion, network configuration is not too well-documented on Ubuntu, and the configuration is spread across many files if you go beyond what the GUI provides.. But thanks to posts like this it is possible to navigate.
Thanks Jan! I really appreciate what you said. BTW, I moved my blog to wordpress.com, I think I like it better.
Post a Comment