The mini-tool has a CLI-Interface with the following options:
- Unicast or Multicast? Default: Unicast
- Locally Administered or Globally Unique? Default: Locally Administered
- Prescribe specific OUI (overwrites the above two)
TODO
- Add an option to generate a number of MACs without collisions.
- MAC Adress on Wikipedia
- redhat's virtualization guide on Generating a new unique MAC address
- A Perl Script that does the same: randmac.pl
- The python module
netaddr
can help you work with MAC addresses.
This code generates a MAC Address globally registered to "Xensource Inc"! The first three bytes are important here, especially the bottom 2 bits of the top byte. I'm also not sure why the top bit of the NIC-specific is forced to zero.
You very likely want this code instead (for a locally administered unicast address):
If you actually have an OUID (top 23 bits) to use, you probably aren't looking at this gist. :)
This also works in bash and others:
I also added this to Stackoverflow here: http://stackoverflow.com/a/43546406/465838
See the definition of a MAC address here.
See the registered OUIDs here (for fun, find the Xensource OUI that the original code was using!).