Link to Project: https://github.com/ShobanChiddarth/randomised_mac_linux
Why a Persistent MAC Address Is a Problem
A persistent hardware address allows networks to consistently identify the same device across sessions. On:
- Public Wi-Fi
- Campus networks
- Enterprise environments
- Captive portals
this makes long-term tracking trivial, even if your IP address changes.
Many Linux desktops still use the permanent hardware address by default, which means your device can be passively identified every time it reconnects to a network.
How This Project Solves It
This project automates MAC address randomisation at boot.
On every system startup:
- The interface is brought down
- A new locally administered MAC address is generated
- The interface is brought back up
A systemd service ensures this runs automatically, requiring no manual action after setup.
Installation
When you install macchanger, you may get a prompt to enable regular changing of MAC addresses. You should select "no" because we wan't complete control over when and how the MAC address randomisation is scheduled.
Debian based
Save this script and run it as sudo
sudo apt install macchanger git -y
git clone https://github.com/ShobanChiddarth/randomised_mac_linux.git
cd randomised_mac_linux
chmod +x ./randomise_MACs.sh
sudo cp randomise_MACs.sh /usr/bin/
sudo cp randomise_MACs.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable randomise_MACs
Now your MAC addresses of real network interfaces will automatically change to a random value on each boot. To verify it, you can run ifconfig to show MAC addresses before and after running sudo systemctl start randomise_MACs to compare values.
Other distros
Visit the GitHub repo and google your distro specific command for each command listed.
Top comments (0)