[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-users] uniq mac address generator



 

> -----Original Message-----
> From: Timo Benk [mailto:timo.benk@xxxxxx] 
> Sent: 13 April 2007 14:34
> To: trilok nuwal
> Cc: Petersson, Mats; Xen list
> Subject: Re: [Xen-users] uniq mac address generator
> 
> Hi,
> 
> > But How i can insure that mac geneareted by this script will
> > be uniq in whole world. Some body in the same network also
> > might use the same script
> > and can get the same  mac as i am .
> 
> You can add a little python to your config files. That way
> you can bind the MAC to the vmid parameter. The vmid
> code is directly extracted off the example configuration.

But that's CERTAINLY doesn't make it unique, unless you also make sure
the rest of the numbers that make up the MAC address are unique to the
world. I also think you need to restrict your VMID to 0..255 in some
way, such as "and 255" or "modulo 256". [Don't know for sure how you do
that in Python].  

--
Mats
> 
> ---<snip>---
> # This function checks that 'vmid' has been given a valid value.
> # It is called automatically by 'xm create'.
> def vmid_check(var, val):
>     val = int(val)
>     if val <= 0:
>         raise ValueError
>     return val
> 
> # Define the 'vmid' variable so that 'xm create' knows about it.
> xm_vars.var('vmid',
>             use="Virtual machine id. Integer greater than 0.",
>             check=vmid_check)
> 
> # Check the defined variables have valid values..
> xm_vars.check()
> 
> 
> # One virtual interface
> vif = [ 'mac=00:11:25:67:30:%0.2x,rate=1024B/s' % vmid ]
> ---<snip>---
> 
> Greetings,
> -timo
> -- 
> Timo Benk - Jabber ID: fry@xxxxxxxxxxxx - ICQ ID: #414944731
> PGP Public Key: http://www.m28s01.vlinux.de/timo_benk_gpg_key.asc
> 
> 
> 
> 
> 



_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.