Skip to content

Instantly share code, notes, and snippets.

@okeuday
Created February 23, 2017 01:55
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 okeuday/c7cbb8e8be2bba2068593ed4aa3be831 to your computer and use it in GitHub Desktop.
Save okeuday/c7cbb8e8be2bba2068593ed4aa3be831 to your computer and use it in GitHub Desktop.
Automatically generate a valid MAC address
#!/bin/sh
# wget http://standards.ieee.org/develop/regauth/oui/oui.txt
DIRECTORY=`dirname $0`
PREFIX=`shuf $DIRECTORY/oui.txt | grep '(base 16)' | head -n 1 | cut -c '3-8'`
SUFFIX=`openssl rand -hex 3 | sed 's/.*/\U&/'`
echo "$PREFIX$SUFFIX"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment