Skip to content

Instantly share code, notes, and snippets.

@dimkr
Created February 13, 2016 12:25
Show Gist options
  • Save dimkr/4df8675778ed75a6b414 to your computer and use it in GitHub Desktop.
Save dimkr/4df8675778ed75a6b414 to your computer and use it in GitHub Desktop.
/etc/udev/rules.d/75-randomize-mac.rules
ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="CURRENT, REAL MAC ADDRESS GOES HERE", RUN+="/bin/bash -c '/bin/ip link set dev %k address `/usr/bin/printf %02x $(($RANDOM % 255))`:`/usr/bin/printf %02x $(($RANDOM % 255))`:`/usr/bin/printf %02x $(($RANDOM % 255))`:`/usr/bin/printf %02x $(($RANDOM % 255))`:`/usr/bin/printf %02x $(($RANDOM % 255))`:`/usr/bin/printf %02x $(($RANDOM % 255))`'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment