2007年1月5日星期五

Ethernet numbering in Ubuntu

2006-08-10 12:35 - Ethernet numbering in Ubuntu

My girlfriend's laptop got bricked, so we replaced it with another laptop of the same make and model, and put in her original laptop's harddisk. Of course, Ubuntu ran fine, but there was one issue: instead of having eth0 and eth1 as WiFi and LAN devices, we had eth2 and eth3. For some reason, Ubuntu refused to re-use eth0 and eth1.

After a bit of digging, I found out that /etc/iftab contains the MAC addresses of network cards:
# This file assigns persistent names to network # interfaces. See iftab(5). eth0 mac 00:01:de:ad:be:ef

This is very useful if you have hot-pluggable NICs that need to keep the same ethX every time you plug them in. Ubuntu's installation put in the MAC addresses of the original network interfaces, so that's why the new hardware skipped eth0 and eth1 and used eth2 and eth3.

Setting the correct MAC addresses in /etc/iftab solved the issue.