How to generate a random mac address on Ubuntu command line

If you are creating a KVM host you can sometimes get the error such XML error: expected unicast mac address. Basically, you if you have manually entered a mac address which meets the Unicast standard then it will cause problems.

Here is a quick way of generating a proper MAC Address:

 openssl rand 6 | xxd -p | sed 's/\(..\)/\1:/g; s/:$//'

Leave a Reply