Ubuntu – In Ubuntu, ensure that the same NIC gets assigned the same interface each time it comes up

mac addressnicUbuntu

I'm running an Ubuntu 9.10 server that has multiple NICs in it. I'd like to make sure that each time the kernel boots up, the NIC with MAC address 01:23:45:67:89:ab gets assigned to eth0 and the one with MAC address ba:98:76:54:32:10 gets assigned to eth1.

On Fedora, I was able to do this by specifying the MAC address in /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=01:23:45:67:89:ab
# the rest of the configuration goes here

(and similarly for ifcfg-eth1).

Is there something equivalent syntax in /etc/network/interfaces for doing this on Ubuntu?

Best Answer

Ubuntu uses udev for hardware detection. Everytime a new NIC is found, udev generates a rule for it so it will use the same physical interface eth0, eth1, ...

If you do not change your hardware, you do not have to care about the interface names, they will stay the same. Should you replace a NIC, it will get the next free interface, eg. eth2. To re-assign eth0 to the new NIC you will have to edit /etc/udev/rules.d/70-persistent-net.rules and delete the old MAC and change eth2 to eth0.

For more information on udev and networking see here.