Keeping mac address for a single network while using disposable sys-net in 4.1

Hi,

First of all thanks for this great project, I really enjoy using Qubes.

I am using a disposable sys-net (Fedora-39) on Qubes 4.1, when I am in my home network I pass the command qvm-run --pass-io sys-net -- nmcli device wifi connect <SSID> password <PASS> to connect. The problem is that it always creates a new random mac address. Even though I like this feature when I am connecting to networks that outside of my home, I don’t want to have a random mac address everytime I connect to my router. Is there way to pass a made up mac address to nmcli similar to this command: qvm-run --pass-io sys-net -- nmcli device wifi connect <SSID> password <PASS> mac-address <MAC-ADDRESS> or do I need to switch to a non-disposable sys-net?

qvm-run --pass-io sys-net -- nmcli connection modify --temporary <connection_name> 802-11-wireless.cloned-mac-address <desired_mac_address>
qvm-run --pass-io sys-net -- nmcli connection up <connection_name>

To learn the current MAC address used to connect to your router:

qvm-run --pass-io sys-net -- nmcli connection show <connection_name> | grep -i 'mac-address'

p.s.: Disclaimer: Fixed mac addresses for WiFi connections is a security hazard.

2 Likes

Thanks and sorry for the late reply, but command to show the current MAC address does only return --. Also I assume that this requires first to connect to network with the original MAC address but how I do this change before the connection?

Also I understand that fixed mac addresses are security hazards, but in my case observability of the machines that connect to network is priority.

It is easy. 1st identify the wireless interface

nmcli device

It is usually wlsX

Then get its parameters via

nmcli device show wlsX

The Hardware MAC address should be stored in GENERAL.HWADDR

1 Like

Unfortunately this does not work. The connection wlsX is not activated as it is not connected to any WiFi access point. It gives me this error:

[user@sys-net ~]$ nmcli device modify wlsX GENERAL.HWADDR AA:BB:CC:DD:EE:FF
Error: Reading applied connection from device 'wlsX' (/org/freedesktop/NetworkManager/Devices/3) failed: Device is not activated

OK. I had to provide better clarification. It is usually something like wlsX (i.e. wls1, wls2, …). X is a number

Sorry I think I didn’t make it clear. Above command run with wls7 value and still gives the same error as it states that WiFi is not activated. nmcli device modify works with Ethernet connection but does not work with WiFi.

Ok. Change of plans. Could you look into the template and see if this file exists (if yes, reading the comments would be useful):

/usr/lib/NetworkManager/conf.d/22-wifi-mac-addr.conf

If yes, you could create an empty file at:

/etc/NetworkManager/conf.d/22-wifi-mac-addr.conf

In your disposable sys-net before making the actual connection (e.g. with touch command)