Re: systemd-networkd MAC address randomization stops working when iwd restarts

James Prestwood <[email protected]> Mon, 23 Feb 2026 05:36:19 -0800
Newsgroups dev.linux.lists.iwd
Message-ID <[email protected]>
Hi Roman,

On 2/22/26 2:37 PM, Roman Žilka wrote:
> Hi,
>
> there's a bug in iwd which may prevent udev from anonymizing the MAC
> address of a wlan interface.
>
> Setup: systemd 258.3, iwd 3.8 or 3.11, a wlan iface, which has
> "MACAddressPolicy=random", "Anonymize=yes", "ActivationPolicy=manual",
> "NamePolicy=kernel path" in systemd and
> "EnableNetworkConfiguration=false" and no address randomization in
> iwd.
>
> After system boot:
>
> # systemctl start iwd
> # networkctl status wlp9s0
> (...)
>            Hardware Address: a2:ed:29:33:92:3b
> Permanent Hardware Address: <physical MAC address, different from address above>
> (...)
>                     Address: 192.168.0.31 (DHCPv4 via 192.168.0.1)
>                     Gateway: 192.168.0.1
>                         DNS: 192.168.0.1
> (...)
>            DHCPv4 Client ID: a2:ed:29:33:92:3b
>
> Everything is working, a random MAC address has been generated. If iwd
> is restarted then (daemon crash, systemctl, ...), I expect udev to
> continue using the random MAC address or generate a new one. However:
>
> # systemctl stop iwd
> # systemctl start iwd
> # networkctl status wlp9s0
> (...)
>          Hardware Address: <physical MAC address>
> (...)
>                   Address: 192.168.0.244 (DHCPv4 via 192.168.0.1)
>                   Gateway: 192.168.0.1
>                       DNS: 192.168.0.1
> (...)
>          DHCPv4 Client ID: <physical MAC address>
>
> IP connection has been re-established, but the MAC address used is no
> longer random. "Permanent Hardware Address" is missing from networkctl
> list. Following the start of iwd, this is appended to the journal:
>
> Feb 22 22:52:50 krb iwd[3522]: No Diffie-Hellman support found, WPS
> will not be available
> Feb 22 22:52:50 krb iwd[3522]: The following options are missing in the kernel:
> Feb 22 22:52:50 krb iwd[3522]:         CONFIG_KEY_DH_OPERATIONS
> Feb 22 22:52:50 krb iwd[3522]: Wireless daemon version 3.11
> Feb 22 22:52:50 krb iwd[3522]: Loaded configuration from /etc/iwd/main.conf
> Feb 22 22:52:50 krb systemd[1]: Started Wireless service.
> Feb 22 22:52:50 krb iwd[3522]: station: Network configuration is disabled.
> Feb 22 22:52:50 krb iwd[3522]: Wiphy: 0, Name: phy0
> (...)
> Feb 22 22:52:50 krb iwd[3522]: event: state, old: disconnected, new:
> autoconnect_quick
> Feb 22 22:52:50 krb systemd-networkd[2520]: wlan0: Link UP
> Feb 22 22:52:50 krb (udev-worker)[3535]: wlan0: Could not set Alias=,
> MACAddress=/MACAddressPolicy=, TransmitQueues=, ReceiveQueues=,
> TransmitQueueLength=, MTUBytes=, GenericSegmentOffloadMaxBytes= or
> GenericSegmentOffloadMaxSegments=, ignoring: Device or resource busy
> Feb 22 22:52:50 krb systemd-networkd[2520]: wlan0: Interface name
> change detected, renamed to wlp9s0.
> Feb 22 22:52:50 krb kernel: mt7921e 0000:09:00.0 wlp9s0: renamed from
> wlan0 (while UP)
> Feb 22 22:52:50 krb iwd[3522]: udev interface=wlp9s0 ifindex=5
> Feb 22 22:52:50 krb (udev-worker)[3537]: wlp9s0: Could not set Alias=,
> MACAddress=/MACAddressPolicy=, TransmitQueues=, ReceiveQueues=,
> TransmitQueueLength=, MTUBytes=, GenericSegmentOffloadMaxBytes= or
> GenericSegmentOffloadMaxSegments=, ignoring: Device or resource busy
> Feb 22 22:52:50 krb systemd-networkd[2520]: wlp9s0: Configuring with
> /etc/systemd/network/21-wlp9s0-dhcp.network.
> Feb 22 22:52:51 krb iwd[3522]: invalid HE capabilities for <MAC>
> Feb 22 22:52:51 krb iwd[3522]: event: connect-info, ssid: <SSID>, bss:
> <MAC>, signal: -63, load: 15/255
> Feb 22 22:52:51 krb iwd[3522]: event: state, old: autoconnect_quick,
> new: connecting (auto)
> Feb 22 22:52:51 krb kernel: wlp9s0: authenticate with <MAC> (local
> address=<physical MAC address>)
> Feb 22 22:52:51 krb kernel: wlp9s0: send auth to <MAC> (try 1/3)
> Feb 22 22:52:51 krb kernel: wlp9s0: send auth to <MAC> (try 2/3)
> Feb 22 22:52:51 krb kernel: wlp9s0: authenticated
> Feb 22 22:52:51 krb kernel: wlp9s0: associate with <MAC> (try 1/3)
> Feb 22 22:52:51 krb kernel: wlp9s0: RX AssocResp from <MAC>
> (capab=0x1411 status=0 aid=21)
> Feb 22 22:52:51 krb kernel: wlp9s0: associated
> Feb 22 22:52:51 krb systemd-networkd[2520]: wlp9s0: Connected WiFi
> access point: <SSID> (<MAC>)
> Feb 22 22:52:51 krb iwd[3522]: event: state, old: connecting (auto),
> new: connected
> Feb 22 22:52:51 krb systemd-networkd[2520]: wlp9s0: Gained carrier
> Feb 22 22:52:51 krb systemd-networkd[2520]: wlp9s0: DHCPv4 address
> 192.168.0.244/24, gateway 192.168.0.1 acquired from 192.168.0.1
>
> systemd has rejected the issue as not theirs and a developer has
> provided some background:
> https://github.com/systemd/systemd/issues/40787 My full .network and
> .link files are in there, too. main.conf:
>
> [General]
> EnableNetworkConfiguration=false
> DisableANQP=false
> DisableOCV=false
> Country=CZ
> DisablePMKSA=false
> [Network]
> EnableIPv6=false
> NameResolvingService=systemd
> [Scan]
> DisablePeriodicScan=true
>
> Thanks,
> Roman

Looks like the issue is in the configuration. IWD removes/creates a new 
fresh interface on startup, which conflicts with how you want to use 
randomization with systemd. If you want systemd to manage the interface 
you need to tell IWD to use the interface systemd/udev creates by using 
this option in main.conf:

[DriverQuirks]
DefaultInterface=<driver>

See man iwd.config for more info on that.

Alternatively you could just use address randomization in IWD, and 
disable it in systemd.

Thanks,

James