WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

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

To: <tim.post@xxxxxxxxxxxxxxx>, "Florian Heigl" <florian.heigl@xxxxxxxxx>
Subject: RE: [Xen-users] handling mac addresses and guid's
From: "Kraska, Joe A \(US SSA\)" <joe.kraska@xxxxxxxxxxxxxx>
Date: Mon, 19 Feb 2007 08:44:35 -0800
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 19 Feb 2007 08:44:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <77abe410702171909p45430ba0x261ea7d95f7af749@xxxxxxxxxxxxxx> <1171848955.15528.80.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcdTxm+TEn65P37CTveO1xzocJ6kbQAfl1OQ
Thread-topic: [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

<Prev in Thread] Current Thread [Next in Thread>