macchanger

Outil de manipulation d'adresse MAC. Change aléatoirement ou définit une adresse MAC spécifique sur une interface réseau pour l'anonymat, le contournement de filtrage MAC, ou l'usurpation. MAC address manipulation tool. Randomly changes or sets a specific MAC address on a network interface for anonymity, bypassing MAC-based filtering, or spoofing.

↗ https://github.com/alobbs/macchanger

Overview

macchanger changes the MAC (Media Access Control) address of network interfaces. Used to bypass MAC-based network access controls, avoid device fingerprinting, maintain anonymity on wireless networks, or simulate specific vendor hardware.

Basic Usage

Show current MAC address

macchanger eth0

Set a random MAC address

macchanger -r eth0

Reset to original/permanent hardware MAC

macchanger -p eth0

Set a specific MAC address

macchanger -m AA:BB:CC:DD:EE:FF eth0

Random vendor (keep same vendor as original)

macchanger -a eth0

Show list of known vendors

macchanger -l
# Show list and filter by vendor
macchanger -l | grep -i "Apple"
macchanger -l | grep -i "Intel"

Requirements

# Interface must be brought down before changing MAC
sudo ip link set eth0 down
sudo macchanger -r eth0
sudo ip link set eth0 up

# Or use the full workflow:
sudo ifconfig eth0 down
sudo macchanger -r eth0
sudo ifconfig eth0 up

Common Use Cases

# Wireless anonymity — randomize MAC before connecting
sudo ip link set wlan0 down
sudo macchanger -r wlan0
sudo ip link set wlan0 up

# Spoof specific device/vendor (blend in)
# Get vendor codes from: macchanger -l
sudo ip link set eth0 down
sudo macchanger -m 00:50:56:AA:BB:CC eth0  # VMware NIC
sudo ip link set eth0 up

# Test on network: use random address each session
sudo ip link set wlan0 down
sudo macchanger -r wlan0
sudo ip link set wlan0 up
sudo nmcli device connect wlan0

Scripted randomization at boot

echo "ip link set wlan0 down && macchanger -r wlan0 && ip link set wlan0 up" >> /etc/rc.local

Bypass MAC Filtering

  1. Scan network to find a trusted MAC address (e.g., from ARP table or promiscuous sniffing)
arp-scan --localnet | grep "trusted_vendor"
# 2. Set your interface to that MAC
sudo ip link set eth0 down
sudo macchanger -m TRUSTED_MAC eth0
sudo ip link set eth0 up

# Note: both devices with same MAC cause ARP conflicts
# Best used when target device is offline

Persistent MAC Randomization (systemd)

# Create systemd service for automatic randomization
cat > /etc/systemd/system/macspoof@.service << 'EOF'
[Unit]
Description=macchanger on %I
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

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

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable macspoof@wlan0.service

Tips

  • Some networks enforce MAC addresses at the port level (802.1X) — MAC spoofing alone won’t bypass this
  • Modern Linux kernel assigns a random MAC by default for WiFi when not connected to a known network
  • Vendor (first 3 bytes OUI) determines which company manufactured the device — choose wisely to blend in
  • Use ip link show to verify MAC change before connecting
Help / Man page
macchanger [options] <interface>

-s, --show      Print current MAC address
-e, --ending    Don't change the vendor (OUI) bytes
-a, --another   Set random vendor MAC of same kind
-A              Set random MAC of any kind
-p, --permanent Reset to permanent (hardware) MAC
-r, --random    Set fully random MAC
-l, --list      List known vendors
-b, --blind     Don't stop if MAC setting fails
-m MAC, --mac MAC  Set specified MAC address

Vue d’ensemble

macchanger change l’adresse MAC (Media Access Control) des interfaces réseau. Utilisé pour contourner les contrôles d’accès réseau basés sur l’adresse MAC, éviter le fingerprinting d’appareil, préserver l’anonymat sur les réseaux sans fil, ou simuler du matériel d’un fabricant spécifique.

Utilisation de base

# Afficher l'adresse MAC actuelle
macchanger eth0

# Définir une adresse MAC aléatoire
macchanger -r eth0

# Restaurer l'adresse MAC d'origine/matérielle
macchanger -p eth0

# Définir une adresse MAC spécifique
macchanger -m AA:BB:CC:DD:EE:FF eth0

# Fabricant aléatoire (garder le même fabricant que l'original)
macchanger -a eth0

# Afficher la liste des fabricants connus
macchanger -l

# Afficher la liste et filtrer par fabricant
macchanger -l | grep -i "Apple"
macchanger -l | grep -i "Intel"

Prérequis

# L'interface doit être désactivée avant de changer la MAC
sudo ip link set eth0 down
sudo macchanger -r eth0
sudo ip link set eth0 up

# Ou utiliser le workflow complet :
sudo ifconfig eth0 down
sudo macchanger -r eth0
sudo ifconfig eth0 up

Cas d’usage courants

# Anonymat sans fil : randomiser la MAC avant de se connecter
sudo ip link set wlan0 down
sudo macchanger -r wlan0
sudo ip link set wlan0 up

# Usurper un appareil/fabricant spécifique (se fondre dans la masse)
# Récupérer les codes fabricants via : macchanger -l
sudo ip link set eth0 down
sudo macchanger -m 00:50:56:AA:BB:CC eth0  # Carte réseau VMware
sudo ip link set eth0 up

# Test sur le réseau : utiliser une adresse aléatoire à chaque session
sudo ip link set wlan0 down
sudo macchanger -r wlan0
sudo ip link set wlan0 up
sudo nmcli device connect wlan0

# Randomisation scriptée au démarrage
echo "ip link set wlan0 down && macchanger -r wlan0 && ip link set wlan0 up" >> /etc/rc.local

Contournement du filtrage MAC

  1. Scanner le réseau pour trouver une adresse MAC de confiance (via la table ARP ou du sniffing en mode promiscuité)
arp-scan --localnet | grep "trusted_vendor"
# 2. Définir cette MAC sur votre interface
sudo ip link set eth0 down
sudo macchanger -m TRUSTED_MAC eth0
sudo ip link set eth0 up

# Remarque : deux appareils avec la même MAC provoquent des conflits ARP
# À utiliser de préférence quand l'appareil cible est hors ligne

Randomisation MAC persistante (systemd)

# Créer un service systemd pour la randomisation automatique
cat > /etc/systemd/system/macspoof@.service << 'EOF'
[Unit]
Description=macchanger on %I
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

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

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable macspoof@wlan0.service

Conseils

  • Certains réseaux imposent l’adresse MAC au niveau du port (802.1X) : l’usurpation MAC seule ne suffit pas à contourner cela
  • Le noyau Linux moderne assigne par défaut une MAC aléatoire pour le WiFi tant qu’il n’est pas connecté à un réseau connu
  • Le fabricant (les 3 premiers octets, OUI) détermine quelle entreprise a fabriqué l’appareil : choisir judicieusement pour se fondre dans la masse
  • Utiliser ip link show pour vérifier le changement de MAC avant de se connecter
Aide / Page de manuel
macchanger [options] <interface>

-s, --show      Print current MAC address
-e, --ending    Don't change the vendor (OUI) bytes
-a, --another   Set random vendor MAC of same kind
-A              Set random MAC of any kind
-p, --permanent Reset to permanent (hardware) MAC
-r, --random    Set fully random MAC
-l, --list      List known vendors
-b, --blind     Don't stop if MAC setting fails
-m MAC, --mac MAC  Set specified MAC address