[one-users] Find the VM IP in the DHCP setup

Ruben S. Montero rubensm at dacya.ucm.es
Thu Jun 4 11:17:28 PDT 2009


Hi,

There are two options:

* As you said you can still use the onevnet just to generate the MAC
address in a predictable and easy-to-find way. In this case, as you
suggest you can use onevm show to get the MAC address.

Then, you can easily pre-configure your DHCP server so to give the MAC
address generated with OpenNebula for your networks.

With your example: ADDRESS = 192.168.1.0 (Please use class C networks)
the MAC address are generated in this way:
MAC = 00:03:c0:a8:01:01, IP = 192.168.1.1
MAC = 00:03:c0:a8:01:02, IP = 192.168.1.2
MAC = 00:03:c0:a8:01:03, IP = 192.168.1.3
MAC = 00:03:c0:a8:01:04, IP = 192.168.1.4
...
MAC = 00:03:c0:a8:01:FE, IP = 192.168.1.254

(note that c0:a8:01 == 192.168.1, so you can derive one from the other)

If you put that assignments in your DHCP server you are done. (And yes
this should be more dynamic, see below...)

* You can not set the MAC and let the hypervisor pick one and modify
the monitoring scripts to push the MAC in the OpenNebula system; and
then get it though onevm show. However if you have a cluster, you have
to make sure that the hypervisors are going to generate different MAC
address so they do not collide.

I strongly recommend you the first one. In particular with the new
features in the upcoming OpenNebula release (hopefully by the end of
the month), that will allow you to:

* Hook in VM creation to add the DHCP entries as the VMs are created
* Hook in VM start-up to execute a custom script to isolate the
traffic from different networks (at layer 2)

We will provide a sample scripts to do this. This functionality is
already in trunk if you want to give it a try let us know and we will
send you the sample script along with some hints (the documentation
for this is not ready yet :(

Cheers!

Ruben

On Wed, Jun 3, 2009 at 6:14 PM, Shi Jin <jinzishuai at yahoo.com> wrote:
>
> Hi there,
>
> I am trying to deploy multiple Windows VM using Open Nebula and am successful with it. However, I am troubled at finding out the IP address the Windows VM is using. Of course, I can use virt-mananager or VNC to directly login to the box from the physical node and find out manually. However, I want something more automatic.
>
> I know there are two ways to setup network in Open Nebula, DHCP and OneVNET. The OneVNET approach requires running a script on the Linux VM, which is not possible for my Windows box and I wouldn't want to impose the user any restrictions in terms of setup their box. So I prefer the DHCP approach.  With control of the DHCP server, in principal I should be able to tell the IP address for any VM given its MAC address. My understanding is that the MAC address is generated randomly in the creation of a VM. It would be nice if command of "onevm show <id>" is able show the MAC address of the NIC.  This is true in the OneVNET scenario but the IP shown is not relevant for me.
>
> For example, I can setup a VNET with
> NAME            = "LAN"
> TYPE            = RANGED
> BRIDGE          = br0
> NETWORK_SIZE    = 32
> NETWORK_ADDRESS = 192.168.1.210
> And use the template of
> NIC = [bridge ="br0",
>       network = "LAN"
>       ]
> This one onevm show will yield something like
>    NAME            : winxp
>    NIC             : BRIDGE=br0,IP=192.168.1.193,MAC=00:03:c0:a8:01:c1,NETWORK=LAN,VNID=7
>
> However, the IP does not make sense at all. Instead the dhcp client on WinXp gets an IP of 192.168.1.130.  But I can discard this IP information and check the DHCP server with the MAC address since it is indeed the same MAC address found inside the WinXP VM.
>
> So my question is that without creating OneVNET (since it is not used at all here), is there a way to show the MAC address of the VM? This should be possible since from the physical node either virt-manager or virsh can tell me that (for example, in the dumped xml file).
>
> Thank you very much.
>
> --
> Shi Jin, PhD
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>



-- 
+---------------------------------------------------------------+
 Dr. Ruben Santiago Montero
 Associate Professor
 Distributed System Architecture Group (http://dsa-research.org)

 URL:    http://dsa-research.org/doku.php?id=people:ruben
 Weblog: http://blog.dsa-research.org/?author=7

 GridWay, http://www.gridway.org
 OpenNebula, http://www.opennebula.org
+---------------------------------------------------------------+



More information about the Users mailing list