[one-users] OpenNebula + DHCP

Carsten.Friedrich at csiro.au Carsten.Friedrich at csiro.au
Mon Nov 29 16:06:11 PST 2010


There is (at least) one more, which I think is the most general and easy to run once set up, if: 

* You want the VMs to be part of your general network.
* You have a DHCP server in your general network.
* You have a fixed set of addresses you want to VMs to use and which are not used by any other machines on the network.

Then:

* Create a bridge on all cloud nodes with the same name (e.g. br0) and bind the NICs on each server to it.
* Create a OpenNebula virtual network with fixed, free addresses like:
NAME = "Small network"
TYPE = FIXED

BRIDGE = br0
LEASES = [ IP="x.y.z.65"]
LEASES = [ IP="x.y.z.66"]
LEASES = [ IP="x.y.z.67"]
LEASES = [ IP="x.y.z.72"]
LEASES = [ IP="x.y.z.73"]
...
...

* Add entries to your DHCP server binding the MAC address OpenNebula will generate for the VM to the corresponding fixed IP. (the MAC address will be a configurable prefix + the IP address in hex).
* Configure your VM images to use DHCP.

Now, when you start a VM, it will get a MAC address from OpenNebula (no context necessary) and then an IP address from your DHCP server. 

Carsten


-----Original Message-----
From: users-bounces at lists.opennebula.org [mailto:users-bounces at lists.opennebula.org] On Behalf Of Ruben S. Montero
Sent: Monday, 29 November 2010 6:32
To: SZÉKELYI Szabolcs
Cc: users at lists.opennebula.org
Subject: Re: [one-users] Opennebula + DHCP

Hi

There are three options to set up networking for a VM:

1.- Use static IPs, i.e hard-coded in the VM image. This is useful for
"well-known" services, but usually people do not use this approach as
it prevents an "install once deploy many" strategy

2.- Use specialized networking VMs,  that runs a DHCP server and
probably any other network related services (DNS, VPN server, routers,
proxy of any kind). This is useful for VM packs, where you define
vnets. Vnets in OpenNebula can be implemented with ebtables (works
out-of-the-box, see [1]) and with VLAN at the switch level (either
setting the vnets before hand, or with a hook to configure the swtich,
e.g. openvswitch)

3.- Context. Context is not just for passing network config parameters
but also for basic service configuration attributes (e.g. ssh keys).
This is  the best approach for stand-alone VMs and probably also for
the virtual network example. It only requires to prepare network configuration
script of the OS to get the IP from the context device.

However, the best approach should be more or less clear depending on
the use-case you are trying to deploy, the networking of your cloud...

Cheers

Ruben

[1] http://www.opennebula.org/documentation:rel2.0:nm

2010/11/28 SZÉKELYI Szabolcs <szekelyi at niif.hu>:
> On 2010. November 27. 18:01:24 Steven Timm wrote:
>> I have never used opennebula with a dhcp server but I think you would
>> have either have to use the contextualization scripts to pass in
>> a modified ifcfg-eth0 that calls for DHCP address, or save a special
>> original image that has them already.  Also you would have to configure
>> the onevnet so you knew which range of MAC addresses your machines were
>> going to have.
>
> Being badly dissatisfied with "contextualization" (there's no ifcfg-eth0 on
> Debian-based systems for example, not mentioning non-GNU/Linux OSes), we
> solved this problem by implementing DHCP on our virtual networks. On VM
> creation, a hook script registers the MAC address and the IP address in the
> DHCP server that assigns it to the VM upon DHCP request. This requires the
> machine running the DHCP server (or a DHCP relay) to have an interface in the
> network used for VMs, but this is usually not a problem as long as you use
> 802.1q tagged virtual networks. This can be implemented for ebtables-based
> vnets as well, but requires a bit tricker setup.
>
> I can provide you with more deatils or even code if interested, but currently
> I don't have time to make proper redistributable and configurable packages.
>
> Cheers,
> --
> cc
>
>
>> On Sat, 27 Nov 2010, Tim Bordemann wrote:
>> > Hi,
>> >
>> > I'm currently evaluating Opennebula for a university's project.
>> > So far I installed Opennebula and am able to start virtual machines on
>> > the server nodes.
>> > Unfortunately I am not sure, how to configure Opennebula or the virtual
>> > machine template so that the vm gets it's IP address from the
>> > DHCP-server. Could anyone please send me a sample vm template?
>> >
>> > Thanks in advance.
>> > Tim
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opennebula.org
>> > http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>



-- 
Dr. Ruben Santiago Montero
Associate Professor (Profesor Titular), Complutense University of Madrid

URL: http://dsa-research.org/doku.php?id=people:ruben
Weblog: http://blog.dsa-research.org/?author=7
_______________________________________________
Users mailing list
Users at lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org



More information about the Users mailing list