Posted by Steve on Fri 23 Feb 2007 at 11:54
If you have multiple ethernet devices upon a system it is useful to make sure they are always given the device names that you expect. This can be useful when you're managing upgrades - or for situations where you accidentally setup a system with eth1 plugged into a switch rather than eth0.
There are several different ways of managing the naming of devices if you're using a dynamic /dev system such as udev or hotplug - but the simplest system which works for most cases is provided by the ifrename package.
Once installed this package will let you rename devices based upon something that shouldn't change their MAC addresses. (Finding MAC addresses of an ethernet device is simple.)
First of all you must install the package:
root@mine:~# apt-get install ifrename Reading package lists... Done Building dependency tree... Done The following extra packages will be installed: libiw28 The following NEW packages will be installed ifrename libiw28 ..
Once installed you may create a new file /etc/iftab to define the mapping between your ethernet device's MAC addresses and the interface names.
The contents of this file should look similar to this:
eth0 mac 00:17:31:56:BC:2D eth1 mac 00:16:3E:2F:0E:9C
With this configuration file in place when you reboot next you'll discover that regardless of your kernel upgrading, that the network card with MAC address "00:17:31:56:BC:2D" will be setup as eth0, and that the card with MAC address "00:16:3E:2F:0E:9C" will be known as eth1.
(The actual renaming will happen automatically via the addition of /etc/init.d/ifrename.)