Todd Zullinger wrote:
Eugeneapolinary Ju wrote:
I just can't find a script that generates a valid MAC address :S
Has anyone has one?
There's one in the cobbler source code (which was pulled from xen).
Something like this perhaps:
For my dime python readability falls somewhere between lisp and apl, but thanks,
this may be useful for testing when multiple VMs are needed to generate load.
$ cat /tmp/genmac.py
#!/usr/bin/python
import random
def generate_random_mac():
"""
Generate a random MAC address.
from xend/server/netif.py
Generate a random MAC address.
Uses OUI 00-16-3E, allocated to
Xensource, Inc. Last 3 fields are random.
return: MAC address string
"""
mac = [ 0x00, 0x16, 0x3e,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff) ]
mac = ':'.join(map(lambda x: "%02x" % x, mac))
return mac
print generate_random_mac()
--
Bill Davidsen <davidsen@xxxxxxx>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines