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/:$//'

One thought to “How to generate a random mac address on Ubuntu command line”

  1. I was had problem with change my mac address on Macbook tried many way but then i found your posted is WORKING ! Thanks ! is show on terminal that my mac address has changed but then when i checked on System Preferences check on hardware mac address isnt change. is show my en1 mac address still same. did i missing anything? Thanks

Leave a Reply to Bee Pri Cancel reply