Problem
By default, the Raspberry Pi Zero generates a random MAC address for WiFi connections to limit device tracking. While this is a good privacy feature for mobile devices, it makes it difficult to track and manage the device on your home network.
Solution
Disable MAC randomization by creating a NetworkManager configuration file.
Steps
1. SSH into your Raspberry Pi Zero
ssh [email protected]
(Or use the appropriate hostname/IP address for your device)
2. Create the configuration file
sudo nano /etc/NetworkManager/conf.d/100-disable-wifi-mac-randomization.conf
3. Add the following content
[device]
wifi.scan-rand-mac-address=no
[connection]
wifi.cloned-mac-address=preserve
4. Save and exit
- Press
Ctrl + Oto save - Press
Enterto confirm - Press
Ctrl + Xto exit
5. Apply the changes
You have two options:
Option A: Restart NetworkManager service (faster)
sudo systemctl restart NetworkManager
Option B: Reboot the system (more thorough)
sudo reboot
Verification
After restarting, you can verify your MAC address remains consistent:
ip link show wlan0
Look for the link/ether line, which shows your MAC address. This should now remain the same across reboots.
Notes
- This change affects all WiFi connections on the device
- The configuration file name starts with
100-to ensure it’s processed in the correct order by NetworkManager - If you ever need to re-enable MAC randomization, simply delete the configuration file and restart NetworkManager or reboot
Related Files
- Configuration directory:
/etc/NetworkManager/conf.d/ - Configuration file:
/etc/NetworkManager/conf.d/100-disable-wifi-mac-randomization.conf
