I am trying to randomize Wi-Fi device MAC address on Debian 11.
A)
$ nmcli device|grep wif
first string of the output is the wifi device name (it is also displayed in "nmcli device wifi" output)
$ sudo macchanger -r WifiDeviceNameHere
It not helped to disable networking.Current MAC: 00:..:..:..:..:.. (wifi vendor name)
Permanent MAC: 00:..:..:..:..:.. (wifi vendor name)
[ERROR] Could not change MAC: interface up or insufficient permissions: Device or resource busy
I could define new MAC under system tray, network icon, connections editor, wifi tab. Apparently the MAC was changed. But I assume no randomization on each restart.
$ su
$ crontab -e
add new line:
@reboot macchanger -r WifiDeviceNameHere
B)
If MAC is not preserved, someone mentioned:
nano /etc/NetworkManager/NetworkManager.conf
if it contains a connection section, leave first line and add next two lines:
If that does not work either, then maybe do:[connection]
ethernet.cloned-mac-address=preserve
$ cd /etc/NetworkManager/system-connections/;ls
and then edit appropriate wifi interface file:
$ nano filename
it should contain:
There is a script which takes the new MAC address (e.g. 00:aa:bb:cc:dd:ee) as argument and then changes all system-connections files to use this new MAC address instead.[wifi]
cloned-mac-address=.....addresshere....
mac-address-blacklist=
mode=infrastructure
ssid=mynetworkname
I am not yet sure how to generate random valid MAC address.
C)
another thing to try:
$ cd /usr/lib/systemd/network/;ls
edit appropriate file (or make new one), maybe:
$ nano 99-default.link
making sure that the [link] section contains:
$ systemd-analyze # is this working to verify the configuration?[Link]
MACAddressPolicy=random
Do you know how to randomize MAC better and more simple?
Bookmarks