Mac Spoofing
Make your MAC address random, we use [macchanger] with udev rules for this. It works for systemd and non-systemd (initd, runnit, etc...)
Dependencies
You only need to install macchanger from your Linux distribution.
Udev rules
Add the following rules to randomize your mac address. arranged from [Tails Linux]
$EDITOR /etc/udev/rules.d/00-mac-spoof.rules
# Note: ATTR{type}=="1" means ethernet (ARPHDR_ETHER, see Linux'
# sources, beginning of include/linux/if_arp.h)
# Disable MAC spoofing for the following devices
# iPhone tethering ethernet over USB
SUBSYSTEM=="net", ACTION=="add", ATTR{type}=="1", DRIVERS=="ipheth", GOTO="mac_spoof_ignore"
# veth interfaces used by network namespaces
ENV{INTERFACE}=="veth*", ACTION=="add", GOTO="mac_spoof_ignore"
# Perform MAC spoofing otherwise
SUBSYSTEM=="net", ACTION=="add", ATTR{type}=="1", RUN+="/usr/bin/macchanger -e $name"
SUBSYSTEM=="net", ACTION=="add", ATTR{type}=="1", GOTO="mac_spoof_end"
LABEL="mac_spoof_ignore"
SUBSYSTEM=="net", ACTION=="add", ATTR{type}=="1", RUN+="/usr/bin/logger -t spoof-mac -p debug \"MAC spoofing discarded by udev rule for $name ($driver)\""
LABEL="mac_spoof_end"
Verify the path of macchanger here fron your system (> where macchanger
).
Special actions
For those using [IWD], you need to edit the config file:
$EDITOR /etc/iwd/main.conf
[General]
UseDefaultInterface=true
You probably need to reboot after that.
The end
Why use macchanger with -e (NIC)
You should not completely randomise the MAC address. Having a completely random MAC address is obvious and will have the adverse effect of making you stand out.
It's all, your system will use udev rules when you boot, reboot or on plug/unplug networks cards.