")
Message-ID: <[EMAIL PROTECTED]>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

[EMAIL PROTECTED] said:
>> Can someone explain how to make the UML side of the tun devices have
>> unique HWAddrs?

Jason Lunz replied:

> Unless you somehow specify otherwise, though, the uml side always gets
> fe:fd:00:00:00:00. 
>
> As mentioned, you can generate random (unique?) ones yourself, and
> assign them to the uml on the uml command line using
> "eth0=tuntap,tap0,fe:fd:00:00:00:02".

Jason's answer was right but depressed me.

I am running about 5 or 6 UMLs on a standard host. They're mostly test
servers for various things (throwing together an FAI installation, an
asterisk installation, etc...) as well as chrooted daemons (like
BIND).

So what I want is the UMLs to ask my local dhcpd for addresses. When
all the guests have the same hardware address that is obviously not
going to work.

But the other constraint for my setup is that I wanted the addresses
assigned to each UML to be consistent. So if I bounce the host or one
particular guest I want the same addresses to be allocated when it
comes back up again.

I tried for about a week to find a way to tie a hardware address to
each particular UML (without me having to manage a registry of
hardware addresses) but that effort came to nothing.

But I have found a solution that satisfies all my constraints and I
thought I'd note it here (shall I put it on the wiki as well?)


dhcp client's can send a dhcp-client-identifier with their request and
the dhcp server can use that to hand out addresses instead of the
hardware address.

So I have a script which makes UML instances and it now looks like
this:

#!/bin/bash
# Script builds a UML from a template

if [ "" == "$1" ]
then
  echo You must specify a name for the uml directory > /dev/stderr
  exit 1
fi

UMLNAME=`basename $1`
UMLDIR=`dirname $0`

# Make the UML from the template
cp -r $UMLDIR/_baseuml $UMLDIR/$UMLNAME

# Change the name of the kernel
mv $UMLDIR/$UMLNAME/_baseuml_kernel $UMLDIR/$UMLNAME/${UMLNAME}_kernel

# Make the swapfile
dd if=/dev/zero of=$UMLDIR/$UMLNAME/swapfile bs=1M skip=128 count=128
mkswap $UMLDIR/$UMLNAME/swapfile

# Rewrite the fs with relevant info
mount -t ext3 -o loop $UMLDIR/$UMLNAME/root_fs $UMLDIR/$UMLNAME/mnt
echo "/dev/ubdb     none    swap  sw  0 0" >> $UMLDIR/$UMLNAME/mnt/etc/fstab
echo $UMLNAME > $UMLDIR/$UMLNAME/mnt/etc/hostname
echo "127.0.0.1    localhost $UMLNAME" > $UMLDIR/$UMLNAME/mnt/etc/hosts
echo "send dhcp-client-identifier \"$UMLNAME\";" >> 
$UMLDIR/$UMLNAME/mnt/etc/dhclient.conf
umount $UMLDIR/$UMLNAME/mnt

# End.


As you can see the dhcp-client-identifier is set to the name of the
UML when I build the UML instance.

I can then use the following stanza in the dhcp server:

  host asterisk {
    option dhcp-client-identifier "umlinstance";
    fixed-address 172.31.2.102;
    option host-name "umlinstance.tapsellferrier.co.uk";
  }

I think this solution is rather good. It certainly is working for me.


Nic Ferrier


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to