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

RE: [Xen-users] handling mac addresses and guid's



Xen's allocated OUI "prefix" is 00:16:3e

There are probably lots of prefixes that will work insofar as you can be
sure that you know your LAN.

Myself, I'd recommend keeping a master table somewhere and incrementally
choosing from MAC addresses for the last tuple, particularly if the
deployment is large. One might mutate this code a little to do that
rather than pick a random number.

Joe.

> -----Original Message-----
> From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-users-
> bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Tim Post
> Sent: Sunday, February 18, 2007 5:36 PM
> To: Florian Heigl
> Cc: xen-users@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [Xen-users] handling mac addresses and guid's
> 
> On Sun, 2007-02-18 at 04:09 +0100, Florian Heigl wrote:
> > Hi,
> >
> > I like Xen's feature of autogenerating those values if they are not
supplied
> in
> > a config file, but for sake of persistency I want to inherit the
once-
> generated
> > values and reuse them after the first creation of a domU.
> >
> > I found it possible to query the values at runtime using xm list
> > --long but I'm not sure I'm going the most elegant route with that,
it
> > would mean either wrapping around xm create or hacking a script to
be
> > executed after domU creation to edit the configfile. This sounds
messy
> > to me.
> >
> > How are You handling this?
> >
> > Thanks!
> > Florian
> >
> 
> I use the following shell function to generate macs. The following is
my
> own code which I'm hereby donating to the public domain. It may be
used
> for any purpose without credit to the author. This code is not
> copyrighted and comes with no warranty.
> 
> # Sets a global _MAC , usage :
> # makemac
> # echo ${_MAC}
> 
> makemac()
> {
>         local prefix="00:00:6d"
>         local hextet[3]=""
>         local hextet[4]=""
>         local hextet[5]=""
>         local tmp=""
>         local i=3;
>         local digi='0a1b2c3d4e5f6789h'
>         local offset=$((${#digi} - 1))
> 
>         _MAC="$prefix"
> 
>         while [ "$i" -le 5 ]; do
>                 tmp[1]="${digi:$(($RANDOM%${offset})):1}"
>                 tmp[2]="${digi:$(($RANDOM%${offset})):1}"
>                 hextet[$i]="${tmp[1]}${tmp[2]}"
>                 _MAC="${_MAC}:${hextet[i]}"
>                 let "i += 1"
>         done
> 
>         unset octet
>         unset tmp
>         unset prefix
>         unset i
> }
> 
> Change $prefix to match what you want, I believe that is the prefix
Xen
> was granted to indicate a 'virtual' nic.
> 
> This should be used when creating the guest, so that it keeps its mac.
> 
> Hope this helps.
> 
> Best,
> --Tim
> 
> 
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users


_______________________________________________
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®.