curl https://gist.githubusercontent.com/wankdanker/2f676cc85f52fd471567/raw -o /usr/local/bin/gen-mac; chmod 755 /usr/local/bin/gen-mac
Last active
December 14, 2015 16:38
-
-
Save wankdanker/2f676cc85f52fd471567 to your computer and use it in GitHub Desktop.
Generate a mac address based on FQDN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#from http://serverfault.com/questions/299556/how-to-generate-a-random-mac-address-from-the-linux-command-line | |
if [ -z "$1" ]; | |
then | |
echo "usage: $0 fully.qualified.domain.name"; | |
exit 1 | |
fi | |
FQDN=$1 | |
echo $FQDN|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment