Dear lazyweb,
I found out the hard way that my laptop's BIOS is not battery-backed. This means that if the battery runs flat (or it is removed for a prolonged time), that BIOS forgets two things: the system time (which is annoying, but easily fixed), and the MAC address of eth0 (which is more than annoying).
As a result, my laptop's MAC address is now set to something rather invalid. Since this MAC address is configured in a few DHCP servers here and there which give me a fixed IP address when they notice my laptop on the network, I'd like to set it back to what it should be.
With ip link set eth0 address <mac> I can easily set the address back to what it used to be. But, of course, that isn't permanent, and once we reboot, it's gone.
So, dear lazyweb: how does one change a MAC address in a permanent way?
There is no standard way to do that. On most hardware, the MAC address is inside an I²C EEPROM connected to the Ethernet controller (and standard controllers will fetch it automatically when reset), while on your system, this appears to be the responsibility of the BIOS.
If you are lucky, then that code lives in the ACPI tables, where it can be found and disassembled, but I wouldn't bet on it.
What about the
hwaddress ether xx:xx:xx:xx:xx:xx
option in your eth0 interfaces stanza?
use pre-up in /etc/network/interfaces:
iface eth inet dhcp pre-up ip link set eth0 address
If this is Debian, you can edit /etc/network/interfaces and set the "hwaddress" field for the interface in question; something like "hwaddress ether 01:23:45:67:89:ab" ought to work, see the interfaces(5) manual page for more information.
If this is a RedHat-style distribution, edit the /etc/sysconfig/network/ifcfg-ethN file for the interface and set HWADDR="01:23:45:67:89:ab".
Hope that helps!
Put that stanza as pre-up in /etc/network/interfaces or use the "built-in"
hwaddress ether xx:xx:xx:xx:xx:xx
Cheers,
rjc