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

Ruben S. Montero rubensm at dacya.ucm.es
Fri Jun 5 03:53:21 PDT 2009


Hi,

> 1. In this approach, I am going to run both my dhcp server and create the VNet, right?

Yes

>I understand that in VNET the IP is generated according to the MAC. However, do I really >have to have thousands of entries in my DHCP server configuration file?

Well you may just set the number of entries you are going to use. But
probably depending the DHCP server you are using you can specify
ranges or something...

> Is there a smarter/better way to do it? Is it in fact the "Hook in VM creation to add the DHCP entries as the VMs are created" you talked about? If so, I would love to try it.

Yes with the Hook we are tackling this problem!.  The code is in the
trunk I'll send you something in a week or so...

>
> 2. You mentioned to use class C network but I don't see why. Is it possible to have class B network so that I am not limited to 256 VMs?

Yes sorry my fault. You can put anything

>
> 3. If I use the VNET, is the MAC generated by Open Nebula or the hypervisor? I think it is >Open Nebula, right?

Yes you are right OpenNebula generates de MAC.

>In this case, is it guaranteed that the newly generated MAC not conflicting with any >existing host in the cluster?

Yes (as long as you do not define the same network twice)

>Will previously used but destroyed MAC be reused?

Yes, when a VM is shutdown the MAC  address is freed and can be
assigned to another VM.

>In addition, I can understand that the MAC is unique among the VMs but how can I make >sure it does not conflict with a physical NIC (although the chances are low)?

Well, the two most significant bytes are set in oned.conf
(MAC_PREFIX). Here you can put a locally administered address eg.
02:00. So, unless you've changed the physical NIC address you should
not have any problem.


Cheers!

Ruben
>
> Thank you very much for your kind input.
>
> Shi
>
> --- On Thu, 6/4/09, Ruben S. Montero <rubensm at dacya.ucm.es> wrote:
>
>> From: Ruben S. Montero <rubensm at dacya.ucm.es>
>> Subject: Re: [one-users] Find the VM IP in the DHCP setup
>> To: "Shi Jin" <jinzishuai at yahoo.com>
>> Cc: users at lists.opennebula.org
>> Date: Thursday, June 4, 2009, 2:17 PM
>> 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
>> +---------------------------------------------------------------+
>>
>
>
>
>



-- 
+---------------------------------------------------------------+
 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