• Creating a Script to Generate MAC Addresses

    Red Hat Virtualization can generate a MAC address for each virtual machine at the time of creation. Since there are 12 million possible numbers on the same subnet is very small, there is a chance you could get the same MAC address. To work around this, you can also write a script to generate a MAC address. This example script contains the parameters to generate a MAC address:

    #! /usr/bin/python
    # macgen.py 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))
    
     The Output will be like : 
    [root@localhost ~]# python genmac.py 
    00:16:3e:63:60:76 
    
    Also ,You can use the following shell script to do so: 
    http://www.easyvmx.com/software/easymac.sh 

    Categories: Xen

    Comments are currently closed.