Page 1 of 1

how to force eth0 to a specific MAC

Posted: Thu Feb 12, 2009 3:05 am
by trouserless
Recently I was installing meteohub on a first generation fit-pc with 2 NICs. Meteohub requires the primary NIC to be eth0 or it will not work properly.

My fit-pc was grabbing its first interface as eth1 and would ignore eth0. I emailed Boris (captain meteohub himself) and he pointed me in the right direction.

In order to force linux, debian in this case, to always bind eth0 to a specific MAC, you need to edit/create:

/etc/udev/rules.d/010_netinterfaces.rules and add:

KERNEL=="eth*", SYSFS{address}=="00:01:c0:03:7c:f6", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="00:01:c0:03:7b:58", NAME="eth1"


it binds the first MAC to eth0 (in my case) and the second one to eth1. When specifying the MAC make sure you use lower case letters for the alpha characters...otherwise udev does not match on the MAC and happily ignores the request (that stumped me for a while).

I hope this someone, and thank you Boris!