Electricmonk

Ferry Boender

Programmer, DevOpper, Open Source enthusiast.

Blog

Debian: MAC address changes: interface changes

Thursday, October 8th, 2009

Since Debian 4.0 or some such, when your MAC address changes, your interfaces changes too. So if you spoof the MAC address of your nic, or you clone a Debian 5.0 VirtualBox guest and assign it a new different random MAC address, or if your nic broke down and you replaced it, the new nic will be assigned to eth1 instead of eth0 (if you previously only had one network card in your machines, that is). Chances are your statically defined network settings (in /etc/network/interfaces) will not work anymore, because they refer to eth0, and not to eth1.

The reason behind this appears to be Udev. It keeps a list of MAC addresses and which interfaces they were assigned to, and when it sees a new MAC, it assumes that is a new network card, and so assigns it a new ethX interface. This is both a good thing, as it will keep your system from rearranging all the nic’s if you add one or one dies, and a bad thing, as your network will not come up anymore if you’ve replaced the previous nic

To fix this, log in at the console as root, find a file named something like persistent-net.rules in the /etc/udev/rules.d/. The file may be prepended with some and remove all the lines in that file below the You can modify it... line.

When done, reboot. (I haven’t yet found out how to regenerate the file. Running the executable the file mentions doesn’t work for me).

The text of all posts on this blog, unless specificly mentioned otherwise, are licensed under this license.