[one-users] DHCP
Valentin Bud
valentin.bud at gmail.com
Wed Jul 23 22:03:28 PDT 2014
Hello Kerry,
When you say "DNS and DHCP are tied into one system on my network" you mean
your DNS server is configured with a dynamic zone that is updated from the
DHCP
server?
If that is so, I guess you want a VM to acquire a lease from the DHCP
server equal
to the IP given by OpenNebula to that specific VM. This way it maintains
consistency.
If you populate CONTEXT with NETWORK="YES", the contextualization packages
will do the job of configuring the network. As far as I know it's not
possible to "tell"
the contextualization packages to leave the network unconfigured. So using
this approach
would not get you where you want.
One way of achieving what you desire is to program a hook that inserts a
host in the
DHCP server via OMAPI [1]. From the hook you have access to the entire
template.
I am assuming you are using ISC DHCP. This would solve the consistency
issue.
Now the VM needs to be configured for DHCP as you mentioned in your
previous E-Mail.
For that you can define SET_HOSTNAME in the CONTEXT to have it available in
the
VM, create a simple (bash) program that reads it and sets ifcfg-eth0
accordingly. Put the
script in the files datastore and update the context to use it via FILES_DS
and INIT_SCRIPTS.
For example you name your super script set_dhcp.sh. You can insert in the
files datastore [2]
using `oneimage create -d files --name set_dhcp.sh --type CONTEXT
/path/to/set_dhcp.sh`.
Update the template to use it.
CONTEXT=[
FILES_DS="$FILE[IMAGE=\"set_dhcp.sh\",
INIT_SCRIPTS="set_dhcp.sh"]
This way the vmcontext init.d script from the contextualization packages
would skip the
network configuration, note NETWORK="YES" is missing and it would run the
set_dhcp.sh
script.
One more thing that comes to mind, SET_HOSTNAME would instruct the
vmcontext init
script to set the hostname and maybe that's not what you want, maybe you
want your VM
to set it's hostname from DHCP. In this case use another variable, like
DHCP_HOSTNAME
in CONTEXT and process it in set_dhcp.sh to configure ifcfg-eth0.
You can set DHCP_HOSTNAME=$NAME inside the template. This way the name you
give the VM in Sunstone would end up being used.
Take the above with a grain of salt, I am sure there are other (better)
ways of achieving
what you desire.
@Diego could you please point me where have you find DHCP in the VNET
template?
I have looked over the docs and couldn't find it.
[1]: http://ipamworldwide.com/dhcp-api.html
[2]: http://docs.opennebula.org/4.6/administration/storage/file_ds.html
Best,
Valentin
On Wed, Jul 23, 2014 at 10:45 PM, kerryhall . <kerryhall at gmail.com> wrote:
> I have managed to figure out how to edit my template (onetemplate update
> TEMPLATE_ID) so I can now set the hostname. However, DNS and DHCP are tied
> into one system on my network, so I can't perform a dig on my new server
> and get the IP back.
>
> I just need to know what lines to add to my template file to get my vms to
> use DHCP only. I'm sure it's something really simple, I just can't find any
> info here:
> http://docs.opennebula.org/4.6/user/virtual_machine_setup/cong.html
>
> If you know how to get DHCP working, please let me know.
>
> Thank you!!
>
>
> On Tue, Jul 22, 2014 at 3:48 PM, kerryhall . <kerryhall at gmail.com> wrote:
>
>> Hi folks,
>>
>> I want to configure Open Nebula to contextualize two items for ifcfg-eth0.
>>
>> BOOTPROTO=dhcp
>> and
>> DHCP_HOSTNAME=<parameter passed in via ONE web interface, even just
>> vm-name would work>
>>
>> I need no other networking settings. DHCP on my network handles the rest.
>> I have tried manually setting these two parameters in ifcfg-eth0 and it
>> looks like it works. (Although the new IP given via DHCP doesn't match the
>> original IP)
>>
>> Is this possible to do in ONE? If so, where do I start?
>>
>> Thanks!
>> Kerry
>>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20140724/8f9e411d/attachment.htm>
More information about the Users
mailing list