Celeb Glow
updates | April 03, 2026

Changing WiFi MAC address on Raspberry Pi 4 Model B with Ubuntu 20.04.2 LTS

I am not confident to report a bug but at least some confusing/unexpected results.

Googling the first 20-30 results on the topic "ubuntu change mac" and "ubuntu change mac netplant" brought me to the following pretty similar attempts:

ip link set dev wlan0 down
ip link set dev wlan0 address 00:11:22:33:44:55
ip link set dev wlan0 up

or

apt install net-tools
ifconfig wlan0 down
ifconfig wlan0 hw ether 00:11:22:33:44:55
ifconfig wlan0 up

or

apt install macchanger
ip link set dev wlan0 down
macchanger --mac=00:11:22:33:44:55 wlan0
ip link set dev wlan0 up

All of the above seems to change the MAC address of the wlan0 and according to my WiFi AP the registered device has the new MAC address 00:11:22:33:44:55, but the DHCP server continues to receive requests from the original MAC address of wlan0. I've never seen anything like this before. Doing some simple ping tests results in some huge drops of the connection generating up to 50% packet loss.

It looks that the better approach (that hopefully will keep the change between reboots) should be editing /etc/netplan/50-cloud-init.yaml. Here it is:

network: ethernets: eth0: dhcp4: true optional: true version: 2 wifis: wlan0: access-points: "WiFi": password: "12345678" dhcp4: true macaddress: 00:11:22:33:44:55 optional: true

Then doing

netplan try
netplan generate
netplay apply

successfully changes the MAC address of the interface and now the AP and the DHCP server are seeing the new MAC address. But again there is a huge packet loss. And after reboot the old MAC address is still in use and again I have to use netplay try|generate|apply to have the new MAC address in place.

Is there anything wrong with my netplan configuration? Or may be the Raspberry Pi 4 B driver doesn't allow MAC change? Or may be I should just use different renderer?

1 Answer

I gave up on utilising netplan and I decided to directly configure systemd-networkd renderer. Here is the solution.

vi /etc/systemd/network/00-default.link
[Match]
MACAddress=original MAC
[Link]
MACAddress=spoofed MAC
NamePolicy=kernel database onboard slot path

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy