MAC Address can be used to track a device. So it is better to use a fake, random MAC address every time it connects. In this tutorial we won’t use any extra tool, just plain simple Network Manager. So this should keep your system light.
To see your connection’s MAC address, you can optionally install macchanger:
sudo xbps-install macchanger
Then run ip addr show to show the interfaces. You will see many interfaces listed like 1: ..., 2: ... etc. The names starting with “en” are ethernet and “wl” are wifi interfaces. Run macchanger -s <interface name> to see the MAC address for that interface.
Below is a way to change MAC address for an interface. After you applied the changes, check with the above macchanger -s command to see if the MAC has really changed. This is totally optional. You can use this below without macchanger, or use it, confirm, and then remove the package.
sudo mkdir -p /etc/NetworkManager/conf.d
sudo nano /etc/NetworkManager/conf.d/30-mac-randomization.conf
[device-mac-randomization]
wifi.scan-rand-mac-address=yes
[connection-mac-randomization]
ethernet.cloned-mac-address=random
wifi.cloned-mac-address=random
sudo sv restart NetworkManager
As a sidenote, MAC address cannot be changed when the device is connected. So you may have to disconnect and reconnect to apply the change.
Although this is written for Void Linux, this is applicable to any Linux distro having NetworkManager. Just change the last command to restart NetworkManager service accordingly.
Sources:
https://wiki.archlinux.org/index.php/NetworkManager#Configuring_MAC_address_randomization
https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/