Sub topic 12
MAC randomization and tracking
This chapter assumes you can read a MAC address as hex and binary. It also assumes you know the locally administered bit (the second-lowest bit of the first octet) and can run ip link show. Here you will see why a permanent MAC address makes a device trackable, how randomization works, and where it stops helping.
Why a fixed MAC is a tracking identifier
A MAC address is sent in the clear in every frame. On Wi-Fi, a phone that searches for networks broadcasts frames, and any receiver in range can read the sender's address, even without joining anything. If the address never changes, a shop, an airport, or an advertiser can place sensors around a site and recognize the same device across visits, days, and locations.
Wired Ethernet has a smaller exposure, because only devices on the same link see the frames. Wi-Fi is the main concern because it is a broadcast medium.
How randomization works
A randomized address is a locally administered unicast address. The device sets the locally administered bit (0x02) and clears the group bit (0x01) in the first octet. The remaining bits are random. Because the address is not assigned by a vendor, it carries no valid OUI. The first octet therefore ends in the hex digit 2, 6, A, or E.
Operating systems use randomization in two places:
- Scanning: the device uses a random address in the frames it sends while searching for networks. Modern iOS, Android, and Windows do this by default.
- Joining: the device uses a random address when it associates with a network.
Joining raises a design question: how often should the address change? The common policies trade privacy against compatibility.
| Policy | Address changes | Effect |
|---|---|---|
| Hardware MAC | Never | Fully trackable, works with every allowlist |
| Per-network stable | Once per saved network | A network sees a consistent device, but different networks cannot link it |
| Per-connection | Every new association | Strongest privacy, but captive portals and DHCP leases treat each visit as a new device |
Android 10 and later and iOS 14 and later default to a per-network stable random address. This lets your home router keep recognizing your phone, while a cafe cannot match it to the airport.
Checking whether an address is randomized
This function reuses the bit logic from earlier chapters.
def looks_randomized(mac: str) -> bool:
first = int(mac.replace('-', ':').split(':')[0], 16)
locally_administered = bool(first & 0x02)
unicast = not (first & 0x01)
return locally_administered and unicast
for mac in ['3c:22:fb:10:20:30', 'da:a1:19:5b:77:02', '02:00:5e:10:00:01']:
print(mac, looks_randomized(mac))The first address has a vendor-style first octet (0x3c), so it prints False. The second (0xda) and third (0x02) have the locally administered bit set, so both print True. A set bit means only that the address is locally administered. Virtual machines, containers, and bridges also use such addresses, so it does not prove randomization.
On Linux you can compare ip link show with the address your Wi-Fi connection actually uses. With NetworkManager, the wifi.cloned-mac-address setting controls it. Typical values are permanent, random, and stable.
What randomization does not fix
A random MAC removes one identifier. Other signals can still link a device:
- Probe request contents, such as supported rates, capabilities, and vendor fields, can form a fingerprint.
- Sequence numbers in 802.11 frames can connect old and new addresses if the device changes address mid-stream.
- DHCP options, such as the hostname, can reveal the device name.
- Logging in to a captive portal or any account ties the session to a person.
- Traffic patterns and the IP addresses you contact can identify you without any MAC at all.
Exercise
A phone joins your home Wi-Fi as da:a1:19:5b:77:02. Your router has a DHCP reservation for the phone's hardware MAC, and the phone no longer gets its reserved IP address. What happened, and what are two ways to fix it?
Show answer
The phone is using a randomized per-network address, which does not match the reservation (note that 0xda has the locally administered bit set). Either turn off private or random addressing for that network on the phone so it uses its hardware MAC, or create a new reservation for the randomized address. The second works only with a per-network stable policy, because the address stays the same for that network.