[Leaplist] polling the dhcp server for an ip

John Simpson jms1 at jms1.net
Wed Apr 11 14:47:07 EDT 2007


On 2007-04-10, at 2223, roland cruse wrote:
>
> I am happy to say I will be doing a demo of Linux-Vserver (
> http://linux-vserver.org) at a future Leap lug meeting. I hope to  
> install a
> vserver kernel and create at least one Virtual Private Server (VPS).

sounds cool, although i've never heard of it. what makes it different  
from something like xen?

> I have
> come across something I can not figure out. The demo will have to  
> use DeVrys
> dhcp for IP addresses of the VPSs I will make on the demo host box  
> (I hope
> that made sense). The problem is that you need to know before hand  
> (as far
> as I can tell) what the ip address will be of the new VPS. Using  
> static ip
> addresses this is not a problem, but not an option in this case. I am
> wondering if there is a way you can easily poll a dhcp server for a  
> free ip
> address?

it's possible- it involves putting the ethernet card in promiscuous  
mode, and creating layer-two packets by hand.

normally the kernel sends layer-three packets (packets where the  
outermost layer of encapsulation is IP, where the source and  
destination of the packet are specified by IP address) to the  
ethernet card, and the card adds the layer-two header (the source and  
destination MAC addresses) before dumping the packet on the wire.

most cards support letting the OS hand already-made layer-two packets  
to the card, in which case it just dumps that packet on the wire  
without any further processing. this allows you to set the "source  
MAC address" for packets leaving the machine. since a DHCP server  
differentiates between machines by the MAC address, this trick of  
explicitly setting the source MAC address is what allows a single  
machine to get multiple DHCP leases.

most virtualization systems use this in order to allow "child"  
sessions to obtain their own DHCP leases from a DHCP server. i don't  
know specifically that this is how "linux-vserver" works, but i would  
imagine this is the case.

however, knowing that devry's DHCP server is sometimes flaky and has  
been known to run out of addresses during a LEAP meeting, you may  
actually be better off with bruce's suggestion of putting an IPCOP  
between devry and your machine- this way the IPCOP will get one IP  
from devry, and then you can get as many IPs as you need from the IPCOP.

at one point i was thinking about building a machine running xen,  
putting IPCOP in one session, and having multiple "internal"  
sessions, all running on one physical machine... and here's the  
kicker: the IPCOP session would have physical access to the outside  
etherent, while the xen0 session would not. i actually had something  
close to this running at one point- the xen0 session was disconnected  
from the physical ethernet and only saw the shared bridge group as an  
interface, while session #1 was running iptables and doing NAT for  
xen0 and the other children. it wasn't IPCOP, but it was the same  
underlying technology that ipcop uses, so it was pretty close.

and now that centos 5 is about to be released, and it will come with  
xen built into it (and in fact the OS installer will pre-install xen  
and set up centos as the xen0 session, right out of the box) i plan  
on doing some testing with that, and doing xen hosting for friends  
and clients. this is why i asked about the differences between "linux- 
vserver" and xen, because within the next month or so i plan to "buy  
into" some kind of virtualization for my own server.

----------------------------------------------------------------
| John M. Simpson    ---   KG4ZOW   ---    Programmer At Large |
| http://www.jms1.net/                         <jms1 at jms1.net> |
----------------------------------------------------------------
| http://video.google.com/videoplay?docid=-4312730277175242198 |
----------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.leap-cf.org/pipermail/leaplist/attachments/20070411/425da25b/PGP.bin


More information about the Leaplist mailing list