Advertisement: Linux VPS from $4/month - contact support for custom offer.
 
+ Post New Thread
Results 1 to 1 of 1

Thread: How to randomize Wi-Fi device MAC address on Debian 11?

  1. #1
    Administrator
    Join Date
    Mar 2013
    Posts
    2,802

    How to randomize Wi-Fi device MAC address on Debian 11?

    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
    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
    It not helped to disable networking.

    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:
    [connection]
    ethernet.cloned-mac-address=preserve
    If that does not work either, then maybe do:
    $ cd /etc/NetworkManager/system-connections/;ls
    and then edit appropriate wifi interface file:
    $ nano filename
    it should contain:
    [wifi]
    cloned-mac-address=.....addresshere....
    mac-address-blacklist=
    mode=infrastructure
    ssid=mynetworkname
    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.

    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:
    [Link]
    MACAddressPolicy=random
    $ systemd-analyze # is this working to verify the configuration?



    Do you know how to randomize MAC better and more simple?
    Last edited by Fli; 03-28-2024 at 12:03 PM.

+ Post New Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam