Sub topic 12
MAC Randomization and Tracking
This chapter assumes you know the MAC address layout from earlier chapters: the 48-bit structure, the OUI, and the group and locally administered bits in the first octet. It also assumes you have seen how a device uses its MAC address in Wi-Fi and Ethernet frames, and that you can run commands in a terminal.
Why a fixed MAC address is a tracking handle
A burned-in MAC address stays the same wherever the device goes. Any observer that sees a frame from your device can read the source MAC address and recognize the device again later. This works without joining the network, without decrypting anything, and without cooperation from the device owner.
Wi-Fi makes the problem worse. A phone with Wi-Fi switched on does not wait for a network to announce itself. It sends probe request frames to find networks nearby. These frames go out before the device has authenticated or associated with anything, and the radio header carries the source MAC address in the clear. Anyone with a radio in range can record it.
Observers can use this in several ways:
- A shop or shopping centre can count repeat visitors and measure dwell time by logging MAC addresses seen by its access points.
- An advertising network can link visits to different places when it operates sensors in several locations.
- A network operator can follow one device across sessions, even when the user logs in under different accounts.
- Someone nearby can build a history of which devices are present at a location and when.
The MAC address is a good tracking identifier for three reasons. It is unique in practice, it is stable over time, and it is sent in every frame. Randomization attacks the second property: it makes the identifier change.
What randomization changes
A randomized MAC address is a locally administered address that the operating system generates instead of using the one assigned by the manufacturer. Recall the locally administered bit from the earlier chapter on universal and local addresses. It is the second-least-significant bit of the first octet (mask 0x02). A randomized address sets that bit to 1 and clears the group bit (mask 0x01), because the address must be unicast.
This has a practical consequence: the first octet of a randomized address always ends in 2, 6, a, or e in hexadecimal. The reason is that the low two bits of that octet must be 10. If you see da:a1:19:... or 4e:0b:7c:..., the address is probably randomized. The OUI lookup from the OUI chapter will find no vendor, because the prefix was never assigned to one.
A randomized address is not a different kind of address on the wire. Frames look the same, and switches learn it exactly as they learn any other MAC address. Only the way the device picks the value changes.
Two kinds of randomization
Operating systems use randomization in two different situations, and they have different goals.
Randomization while scanning
A device that is not connected to any network can use a random source address for probe requests. Each scan, or each interval of scans, uses a new address. This stops passive observers from linking probes together.
Early implementations of this had a known weakness. The probe request contains more than the MAC address. It also carries information elements such as supported rates, capabilities, vendor-specific fields, and sometimes the names of previously joined networks. The combination of these fields can form a fingerprint that is stable across address changes. A tracker can use it to link probes from the same device even when the MAC address differs each time. Modern systems reduce this by sending fewer identifying fields and by not sending directed probes for saved network names.
Randomization per network
Once a device joins a network, it uses a MAC address for the whole association, and changing it in the middle of a session would break connections. Modern systems therefore generate a random address for each network (identified by SSID) and reuse it every time the device rejoins that network. This is sometimes called a private or per-network address.
The result is a trade-off between privacy and stability:
- Different networks see different addresses, so two networks cannot compare logs to find the same device.
- The same network sees the same address on every visit, so DHCP reservations, captive portal sessions, and MAC-based access lists still work after the first time.
Some systems generate the per-network address from a keyed hash of the network name and a secret stored on the device. Others store a randomly generated value. Some add a rotation: the address changes periodically, for example every 24 hours, or each time the user forgets and rejoins the network.
The table summarizes the common modes.
| Mode | When the address changes | Tracking resistance | Operational side effects |
|---|---|---|---|
| Hardware address | Never | None | None |
| Random per scan | Every scan or interval | High against passive probe logging | None once connected |
| Random per network, fixed | Only when the network is forgotten | Medium. Networks cannot compare logs, but one network can recognize a returning device | Stable for DHCP and access lists after first join |
| Random per network, rotating | On a schedule or after reconnect | Higher | Can trigger repeated captive portal logins and new DHCP leases |
The scan-and-join sequence
The diagram shows what an observer sees from a phone that scans and then joins a known network.
The observer cannot connect the scan address to the per-network address unless it also saw the association. The access point sees only the per-network address and cannot tell which hardware address lies behind it.
Checking whether an address is randomized
You can test the locally administered bit in code. The function below extends the idea from the MAC anatomy chapter. It reports whether an address is locally administered and unicast, which is the signature of a randomized address. It cannot prove randomization, because an administrator can also set the bit by hand, and virtual machines and containers commonly use locally administered addresses too.
def looks_randomized(mac: str) -> bool:
parts = mac.replace('-', ':').split(':')
if len(parts) != 6:
raise ValueError('a MAC address has 6 octets')
first = int(parts[0], 16)
is_group = bool(first & 0x01)
is_local = bool(first & 0x02)
return is_local and not is_group
samples = [
'3c:22:fb:10:20:30', # universally administered, vendor assigned
'da:a1:19:5b:c2:07', # locally administered unicast
'02:00:5e:10:00:01', # locally administered, often seen in virtual setups
'01:00:5e:00:00:fb', # group address, not a device source
]
for mac in samples:
print(mac, looks_randomized(mac))The third sample shows the limit of this test. Its first octet is 02, so it is flagged, yet nothing about it is random. A fleet of devices that all show 02:... addresses is more likely virtual or administratively assigned than randomized.
On a Linux machine you can see which address an interface is using, and whether it differs from the permanent hardware address, with these commands:
# Current address of the interface (may be randomized)
ip link show wlan0
# Permanent hardware address, if the driver exposes it
ethtool -P wlan0
# Ask NetworkManager how it handles Wi-Fi address randomization
nmcli -f 802-11-wireless.cloned-mac-address connection show "MyNetwork"NetworkManager accepts values such as permanent, random, stable, and a literal address. stable produces the per-network behavior described above. random generates a new address on each connection.
What randomization breaks
Randomization is not free. Systems that assumed a MAC address is a stable identity can fail in several ways:
- MAC-based access control. An allow list of known devices no longer matches when the device presents a different address. Users have to register the per-network address, not the hardware address printed on the device.
- DHCP reservations. A reservation tied to a MAC address stops applying after the address rotates, and the device gets a different IP address.
- Captive portals. Many portals remember a device by MAC address. A rotating address makes users sign in again.
- Network inventory. Asset tools that key devices by MAC address count one device as many, and the numbers drift upward over time.
- Parental controls and per-device policy. Rules tied to a MAC address stop matching.
The fix is to move identity to something stronger. Use 802.1X authentication with per-user or per-device credentials, certificates, or an account-based portal. These identify the device or person directly instead of relying on a value that the device is free to change.
Where randomization does not help
Randomization removes one identifier. A device can still be recognized through other signals:
- Higher-layer identifiers. A DHCP request can carry a hostname and a client identifier. A device that sends its name as
Alexs-iPhoneis identified no matter what its MAC address is. Modern systems limit these fields on randomized networks. - Cookies, accounts, and logins. Once you sign in to a service, the service knows who you are.
- Radio fingerprints. Small imperfections in a transmitter, such as clock drift and signal timing, differ between devices and can in principle be measured.
- Traffic patterns. The timing and size of packets can be distinctive.
- A fixed per-network address. If the address never rotates, one network can follow the device across visits. That is a property of the design and is usually acceptable, but it is not anonymity.
Randomization is therefore best treated as a reduction in passive, cross-network tracking. It does not make a device anonymous.
Practical decisions
For users, keep the default private address setting on for public and untrusted networks. Turn it off, or choose the fixed per-network mode, only on a network you control where a MAC-based rule needs a stable address. If a network refuses to work with randomization, the better long-term fix is to change the network's authentication method.
For network administrators, plan for randomized clients. Stop treating the MAC address as the primary key in inventory and policy. If you need to recognize a device, use 802.1X or another authenticated identity. Expect to see locally administered addresses in your tables and do not filter them out as suspicious.
Exercise
A phone shows the address be:7a:41:09:d2:6c on your office Wi-Fi. A colleague says that proves the phone's manufacturer is unknown. Check the first octet and explain what the address most likely is, and what you should use instead if you want a policy that follows this phone from visit to visit.
Show answer
The first octet is be, which is 10111110 in binary. The least significant bit is 0, so the address is unicast. The next bit is 1, so it is locally administered. That combination means the address was assigned by software, and the phone is most likely using a per-network randomized address. The OUI does not identify a manufacturer because the prefix was never issued to one, so the colleague's conclusion about an unknown vendor is wrong. The phone is probably an ordinary device with privacy settings on. For a policy that follows the phone, do not rely on the MAC address, which may rotate. Use 802.1X with a device certificate or user credentials so that the network recognizes the phone by an authenticated identity.
Exercise
A hotel captive portal asks a guest to sign in again every day, although the guest has not changed anything. The portal remembers devices by MAC address. Give the most likely cause and one way to fix it from the network side.
Show answer
The guest's device uses a rotating per-network randomized MAC address, so the portal sees a new address each day and treats it as a new device. From the network side, stop keying sessions on the MAC address and use an account-based or token-based session instead, such as a voucher or room-number login tied to a cookie or an authenticated identity. A weaker workaround is to lengthen the portal's session memory. The guest can also choose the fixed per-network address setting for this network.