Wednesday, April 20, 2016

Linux - Random MAC address at boot (systemd)

1. Determine you wireless adapter name:
$ iwconfig | grep 802.11bg

2. Create and edit /etc/systemd/system/macspoof@.service file for a new startup service as superuser / root
[Unit]
Description=macchanger on %I
Wants=network-pre.target
Before=network-pre.target
After=sys-subsystem-net-devices-%i.device

[Service]
ExecStart=/usr/bin/macchanger -r %I
Type=oneshot

[Install]
WantedBy=multi-user.target

3. Enable this script run each time you linux is booted
$ sudo systemctl enable macspoof@wlp2s0.service
* Note : Please replace "wlp2s0" with you adapter card name on step 1

4. Now reboot you computer and after booted, check you current MAC address:
$ macchanger --show wlp2s0
Current MAC:   ea:f7:07:3f:fa:b8 (unknown)
Permanent MAC: 25:7d:9f:uc:k7:c0 (Intel Corporate)

No comments:

Post a Comment