brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: NetworkManager can use a random MAC address every time you join a Wi-Fi network

Linux
~/tips/tip-privacy-networkmanager-random-mac

nmcli connection modify "Cafe Wifi" 802-11-wireless.cloned-mac-address random

Makes NetworkManager use a random or per-network MAC address for a Wi-Fi connection.

A laptop that shows the same hardware address on every Wi-Fi network is easy to follow around. I already like the private Wi-Fi address on the Mac and iPhone; on Linux with NetworkManager there is a setting for the same idea.

Look up the name of the Wi-Fi connection profile, then set the cloned MAC address:

nmcli connection show
nmcli connection modify "Cafe Wifi" 802-11-wireless.cloned-mac-address random
nmcli connection up "Cafe Wifi"

The profile name is a placeholder. The last line reconnects so the new setting applies. The manual lists the special values for this property: preserve leaves the MAC address alone, permanent uses the hardware address, random creates a new random address on each connect, stable creates a hashed address based on the connection’s stable ID and a machine-dependent key, and stable-ssid does the same based on the network name.

I would think about stable-ssid before random. A random address on every connect looks like a new device to the router each time, so a MAC filter or a fixed DHCP reservation on a home network can stop working. A stable-ssid address stays the same for one network, but differs between networks.

The caveat is that this only hides the hardware address. It does not hide anything else about you on that network. And if your router only lets known MAC addresses in, keep the permanent address on that one profile.

Further reading: NetworkManager: 802-11-wireless settings, nmcli manual

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link