User Tools

Site Tools


When you install Ubuntu Feisty the installer “hardcode” the logical interface names to specific nic's. That is okay, if you only have one interface. However it can give you some headache if you have more than that. I installed my workstation while I had a nic in the pc-card slot which got bound to eth0. I like having the eth0 bound to my permanent ethernet interface on the motherboard. It took some time until I stumbled upon the file /etc/iftab:

# This file assigns persistent names to network interfaces.
# See iftab(5) for syntax.

eth0 mac 00:16:41:59:e9:eb arp 1
#eth0 mac 00:10:a4:76:01:bc arp 1
eth1 mac 00:13:02:87:46:e5 arp 1

Here I found the missing link between the naming of the logical interface and the ethernet device.

You use the file by matching the mac address of the ethernet device and the logical name. Take a look at the output from my ifconfig:

tdd@dubex-tdd:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:41:59:E9:EB  
          inet addr:X.X.X.X  Bcast:X.X.X.X  Mask:255.255.255.X
          inet6 addr: fe80::216:41ff:fe59:e9eb/64 Scope:Link
          RX packets:68470 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66077 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:38442253 (36.6 MiB)  TX bytes:26855891 (25.6 MiB)
          Base address:0x3000 Memory:ee000000-ee020000 

eth1      Link encap:Ethernet  HWaddr 00:13:02:87:46:E5  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:249 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:21 Base address:0xa000 Memory:edf00000-edf00fff 

From this output you can see the mac address (00:16:41:59:E9:EB) which is put into iftab file like shown above.

The man pages for iftab can help you with other or more advanced settings.

Update: As for later releases the iftab files is replaced by a udev rule.

If you look into /etc/udev/rules.d/70-persistent-net.rules you'll find the following:

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:27:ac:d5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:27:ac:da", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Here you see the relation between MAC address and logical name.

howtos/iftab.txt · Last modified: d/m/Y H:i by domingo