Generate random MAC address for e.g. Xen guests

The following tiny python script can be used to generates a MAC address for different purposes e.g. Xen guest.

! /usr/bin/python script generates a MAC address for Xen guests

import random mac = [ 0x00, 0x16, 0x3e, random.randint(0x00, 0x7f), random.randint(0x00, 0xff), random.randint(0x00, 0xff) ] print ':'.join(map(lambda x: "%02x" % x, mac))


blog comments powered by Disqus
Fork me on GitHub