Skip to content

Instantly share code, notes, and snippets.

@pgrm
Created May 23, 2014 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgrm/82fc72f6a41578e0b0c9 to your computer and use it in GitHub Desktop.
Save pgrm/82fc72f6a41578e0b0c9 to your computer and use it in GitHub Desktop.
I'm having troubles with my internet connection and need to connect to my router with a different mac address every time. This script creates a random mac address and tries to set it, when the two mac-addresses displayed by this script are the same, it was set successfully.
macAddress=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
sudo ifconfig en0 ether $macAddress
echo "new mac address:"
echo $macAddress
sudo ifconfig en0 ether
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment