by QwenAI | Verified on Arch Linux + NetworkManager β₯ 1.18
β Goal:
- Apply the same spoofed MAC to all Wi-Fi connections (global).
- Optionally set a custom DHCP hostname per network (e.g.,
Galaxy-A06instead ofNix).
π§ Why it works: Uses NMβs nativecloned-mac-addressanddhcp-hostnameβ no race conditions, no leaks.
π§ 1. Global MAC Spoofing (All Wi-Fi)
Step 1: Create policy file
sudo mkdir -p /etc/NetworkManager/conf.d/
sudo tee /etc/NetworkManager/conf.d/99-global-mac-address.conf <<'EOF'
[keyfile]
unmanaged-devices=
[connection-wifi]
# Global default for *all* Wi-Fi connections
wifi.cloned-mac-address=DE:AD:BE:EF:CA:FE
EOF
π Replace
DE:AD:BE:EF:CA:FEwith your desired MAC (e.g.,90:01:C0:DE:13:37).
Step 2: Reload NetworkManager
sudo systemctl reload NetworkManager
# If changes donβt apply, restart:
# sudo systemctl restart NetworkManager
Step 3: Verify
macchanger -s wlp4s0
# β
Expected output:
# Current MAC: DE:AD:BE:EF:CA:FE
# Permanent MAC: 9c:2f:9d:77:9c:67
π‘ List active connections:
nmcli -g NAME con show --active
π― 2. Per-Network Hostname Spoofing (Optional)
Make your device appear as a different device (e.g., phone, IoT) in the router UI:
nmcli con modify "MyWiFi" \
ipv4.dhcp-hostname "Galaxy-A06" \
ipv4.dhcp-send-hostname yes
β Replace:
"MyWiFi"β your connection name (e.g.,"HUAWEI-5G-8BbD")"Galaxy-A06"β any believable name (Smart-TV,Printer-HP,Lumen, etc.)
π Reconnect to apply:
nmcli con down "MyWiFi" && nmcli con up "MyWiFi"
π Why it works: Most home routers (Huawei, TP-Link) display
dhcp-hostnameas Device Name β not the system hostname.
π References
- Arch Wiki: MAC spoofing β NetworkManager
man NetworkManager.confβconnection-*.wifi.cloned-mac-address
