Re: Change MAC address permanently

From: Calvin Walton
Date: Wed Mar 07 2012 - 10:46:11 EST


On Thu, 2012-02-23 at 10:52 +0100, Christian Gmeiner wrote:
> Hi all,
>
> I have found out that ioctl SIOCSIFHWADDR could be used to change the
> current MAC address
> of an Ethernet device. But the big problem is that after an reboot the
> change is gone. Is there
> an other way of changing the MAC address permanently?

An option that may be sufficient for your needs is if you simply modify
your Linux startup scripts to reset the MAC address of the card every
time the computer boots, by using a udev rule or editing the network
init script.

But if you /really/ want to change the MAC address burned into the
hardware...

In most PC network cards, the MAC address of the device is stored in an
EEPROM on the device, and has an initial value flashed when the device
is assembled.

Depending on the network card and driver in question, you may be able to
view and modify the contents of the EEPROM (which will contain various
other data that you want to avoid changing!) with the ethtool -e and -E
options. This can be a dangerous operation, so read the ethtool man page
first, and be careful.

--
Calvin Walton <calvin.walton@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/