2016年6月28日 星期二

[Linux][Generate Random Mac Address]

echo -n 00:60:2F; dd bs=1 count=3 if=/dev/random 2>/dev/null |hexdump -v -e '/1 ":%02X"'

Output will be like "00:60:2F:7A:ED:D0".

If you want "00-60-2F-7A-ED-D0", just change the symbol ":" to "-" in the command.

Reference:
http://superuser.com/questions/218340/how-to-generate-a-valid-random-mac-address-with-bash-shell

沒有留言:

張貼留言