MAC changing


I have been using piaware-mutability to modify the base MAC address on a Pi 2. I would like to use a simpler method and in another thread i saw the suggestion to use smsc95xx.macaddr=b8:27:eb:xx:xx:xx in the /boot/cmdline.txt.

This didn’t work for me, it created a new station as soon as I connected.

Any ideas why this might not work?


Did you use “smsc95xx.macaddr=b8:27:eb:xx:xx:xx” exactly?

Or change the xx:xx:xx to what you actually want?


No, I changed the xx to match the MAC address on the PI, the same one listed on my stats page. I now have a second station which has the actual MAC address of the machine, ie, the MAC didn’t change.


piaware will look at the contents of /sys/class/net/eth0/address or, failing that, the output of ifconfig, so you might want to check that those have updated as expected.


/sys/class/net/eth0/ has the incorrect address so it’s not updating.

ifconfig shows:

eth0 Link encap:Ethernet HWaddr b8:27:eb:dd:12:2e
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr: Mask:
RX packets:18229 errors:0 dropped:0 overruns:0 frame:0
TX packets:18229 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5599584 (5.3 MiB) TX bytes:5599584 (5.3 MiB)

wlan0 Link encap:Ethernet HWaddr e8:4e:06:19:2e:b9
inet addr: Bcast: Mask:
RX packets:1216 errors:0 dropped:1 overruns:0 frame:0
TX packets:1178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:174623 (170.5 KiB) TX bytes:1132710 (1.0 MiB)


I seem to have got it working. The only thing I changed was to delete a newline that I had keyed between rootwait and smsc95xx.macaddr=

Hmm :confused:


I had the same problem and removing the return/newline from the /boot/cmdline.txt worked for me as well. Both the /sys/class/net/eth0/address and the ifconfig are updated to the cmdline.txt value.

Thanks for adding the note on the newline. I also avoided any extra whitespace characters.


cmdline.txt is EXACTLY that – a single line of occasionally improbable length!

(and trap for beginners #32… 32 of how many? That would be telling and would spoil all the fun…)


Thought I’d ask before sticking my foot in it. Site 2394 is a RPi B which I want to swap out with a Pi B+ or Pi 2. If I change the MAC address to the old one, that should work. Can I change the MAC address and retain that address on the SD image? I’d like to just save the image, burn it to a new SD and plug in it into the new PI (SD card form factors differ so I can’t just move it). What am I missing?


I’d like to just save the image, burn it to a new SD and plug in it into the new PI (SD card form factors differ so I can’t just move it). What am I missing?

Assuming you are running the PI headless thus on the network, using the image method will result in a brief period (before cmdline.txt modification) where your PI B+ or 2 will have whatever MAC is in the .img’s cmdline.txt file if one exists otherwise it will naturally have the MAC native to the new unit.

If you have a USB SD card R/W module that accommodates the micro SD for your PI B+ or 2, you can clone the B’s SD card to the micro SD.

I have used this script with great success.
(I came across this when trying to put an .img file on a SD card of the same size but it would not fit because the new card had slightly less capacity than the original one.)

With the MicroSD card still in the old B’s USB port, you can mount and edit the microSD’s boot/cmdline.txt file then move it to and boot your B+ or 2 with it.

The script will take care of mounting the MicroSD for you for the cloning process but you will have to mount it again to access it for editing. If you aren’t familiar with the procedures for mounting “disks”, you can easily become an expert with a few Google searches.


I haven’t tried this, but since the Pi runs on a debian like OS, would the same thing I do on Debian of putting a startup script in /etc/network/if-up.d work?

On Debian I create a file there called “changemac” and put this in it:


if  "$IFACE" = eth0 ]; then
  ip link set dev "$IFACE" address aa:bb:cc:dd:ee:ff

chmod it to 755

then when you reboot that will change the MAC to what you have set here. The only issue I’ve had with this way is it seems when I’ve done it, it only works if you configure it with a static IP.


Just keep it to the standard setup.

sudo pico /boot/cmdline.txt

It’s a single line - Don’t add any!

It will look like:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait smsc95xx.macaddr=b8:27:eb:xx:xx:xx

…except for the very end. Add that in and change the MAC address to the one needed. Make sure there are not two using the same address at the same time.

And remember, it’s all ONE line.


Yes I am just trying to standardise things between OS’s if I can to make it easier. I will have to try things out, just curious with all the experimenters here if anyone has tried it.


to antthomas, nekota, obj and Bob rtm, and to joelwiley for pointing to this discussion -

you guys rock. This is exactly what was needed to transition my longest running RPi ADS-B station to a new Pi board without losing my currently 287 days of service!

I did the same error at first in using a new line in cmdline.txt. Once I had the “duh” moment from both nekota’s and Bob’s comment, everything fell into place and it works fine.

Cheers and 73 - Jon N7UV