Skip to content

Instantly share code, notes, and snippets.

@zoonderkins
Created July 9, 2025 00:28
Show Gist options
  • Save zoonderkins/b78597834f56c1f4f37d24bfee977f8e to your computer and use it in GitHub Desktop.
Save zoonderkins/b78597834f56c1f4f37d24bfee977f8e to your computer and use it in GitHub Desktop.
random-reset-mac-address

Linux

INTERFACE=""
NEW_MAC=$(printf '02:%02x:%02x:%02x:%02x:%02x\n' $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)))
sudo ip link set $INTERFACE down
sudo ip link set $INTERFACE address "$NEW_MAC"
sudo ip link set $INTERFACE up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment