It’s easy enough to change your network adapter’s MAC address once you have a Debian/Ubuntu system installed, but I needed to do this from within the Debian installer (Lenny beta 2), and it took me a while to figure out how. So I’m making a note of it for my own future reference, and maybe someone googling for the phrases I initially did will find this helpful.
So here’s the problem: my NIC’s default MAC address is (say) 01:02:03:04:05:06
, and for one reason or another, I need it to be 06:05:04:03:02:01
instead. Furthermore, I need this change to be in effect while I’m inside Lenny’s installer, so ifconfig
is not available. Here’s how I did it:
- From the installer’s boot menu, select
Advanced options
, andExpert install
. - Work your way down the steps as needed, starting from the top, until you’ve gone through
Detect network hardware
. Instead of the next one (Configure the network
), pickExecute a shell
from further down the menu. - In the shell you can check your network interface status with
# ip link show eth0
You might use
eth1
or some other port instead ofeth0
, but I haven’t done this with anything other than the one NIC I had in the setup, and so haven’t used anything besideseth0
.
In my case, entering the command gives the following output:2: eth0: mtu 1500 qdisc noop qlen 1000 link/ether 01:02:03:04:05:06 brd ff:ff:ff:ff:ff:ff
- Next, the spell you’ve been waiting for. Let’s change that MAC address!
# ip link set eth0 addr 06:05:04:03:02:01
If all goes well,
ip
won’t say anything. Re-run the ‘show
‘ command listed in the previous point to see that it actually worked. - Type
exit
to return to the installer. - Now you pick up from
Configure the network
, and proceed installing from there.
One last point: the changed MAC address won’t survive the reboot finalizing the installation, so if you want to make it permanent, you’ll want to set it after the first boot into your new system, by using the method I linked to in the beginning (editing /etc/network/interfaces
). Or you could to do it from the installer, using nano
(in busybox
).
Comments
3 responses to “Debian (Lenny): How to change MAC address while installing”
[…] (I’m reposting this from my other, more generic blog.) […]
Great info – saved my life.
Actually, you don’t have to choose Expert Install. You can start a normal install and Ctrl-Alt-F2 to the second console.
Glad you found it useful, and thanks for the console-switching tip!