[Openstack] [OpenStack][Nova] Configuring IP address on a DHCP disabled network

Brent Troge brenttroge2016 at gmail.com
Thu Jul 21 19:30:29 UTC 2016


Let me look at my notes as I worked this out before using outputs and
cloud-config directives..

The idea is for cloud-config to write your outputs to a temp file on the
VM.
Something like this:

<MAC ADDRESS> <IP ADDRESS>
<MAC ADDRESS2> <IP ADDRESS2>


Now with your user-data script you can parse the injected file and use
those values to create your network files.
With everything in place, either restart the network or have cloud-init
reboot the VM once it is instantiated.





On Thu, Jul 21, 2016 at 2:18 PM, Kaustubh Kelkar <
kaustubh.kelkar at casa-systems.com> wrote:

> Thanks for the pointer. However, using those outputs to inject user data
> seems to create a circular dependency:
>
> myserver:
>
>   type: OS::Nova::Server
>
>     properties:
>
>       name: test-vm
>
>       image: ubuntu-16.04
>
>       flavor: m1.small
>
>       networks:
>
>        - network: { get_param: [ mgmt, id ] }
>
>        - network: { get_param: no_dhcp_net }
>
>       user_data_format: RAW
>
>       user_data:
>
>         str_replace:
>
>           template: |
>
>             #!/bin/bash
>
>             echo -e "\n" >> /etc/network/interfaces
>
>             echo "auto ens4" >> /etc/network/interfaces
>
>             echo "iface ens4 inet static" >> /etc/network/interfaces
>
>             echo "address $IPADDR" >> /etc/network/interfaces
>
>             echo "netmask 255.255.255.0" >> /etc/network/interfaces
>
>             ifdown ens4 2>/dev/null
>
>             ifup ens4 2>/dev/null
>
>           params:
>
>             $IPADDR: { get_attr: [ myserver, addresses, no-dhcp-net, 0,
> addr ] }
>
>
>
> For now, I am going back to creating port and pass in that information as
> user data.
>
>
>
>
>
> -Kaustubh
>
>
>
> *From:* Brent Troge [mailto:brenttroge2016 at gmail.com]
> *Sent:* Wednesday, July 20, 2016 7:27 PM
> *To:* Kaustubh Kelkar <kaustubh.kelkar at casa-systems.com>
> *Cc:* openstack at lists.openstack.org
> *Subject:* Re: [Openstack] [OpenStack][Nova] Configuring IP address on a
> DHCP disabled network
>
>
>
> Isn't that exposed through outputs ?
> And then use the output combined with configdrive cloudinit  to configure
> your NICS
>
> outputs:
>   instance_ip:
>     description: The IP address of the deployed instance
>     value: { get_attr: [my_instance, first_address] }
>
>
>
> On Jul 20, 2016 5:58 PM, "Kaustubh Kelkar" <
> kaustubh.kelkar at casa-systems.com> wrote:
>
> My use case involves booting up an instance attached to two networks – one
> having Neutron DHCP service running and one without. Looking within the
> documentation [1], I was hoping to use configuration drive to provide IP
> information for the second interface. But, if I understand correctly, one
> could theoretically pass any IP information through it; which may or may
> not match the IP that is assigned to the Neutron port. I wonder if there is
> any way the actual IP assigned to the Neutron port is exposed in some way
> within the VM.
>
>
>
> One crude workaround I can think of is to create a port beforehand with a
> fixed IP, and use this information to configure static networking within
> the VM. However this might not be manageable if a user launches numerous
> VMs since he/she will have to ensure that IPs do not overlap.
>
>
>
> [2] looks promising, but I am not clear how I can just specify the second
> interface only.
>
>
>
> [1] http://docs.openstack.org/user-guide/cli_config_drive.html
>
> [2] http://blog.oddbit.com/2015/06/26/openstack-networking-without-dhcp/
>
>
>
>
>
> Thanks,
>
> Kaustubh
>
>
> _______________________________________________
> Mailing list:
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to     : openstack at lists.openstack.org
> Unsubscribe :
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20160721/a28b9540/attachment.html>


More information about the Openstack mailing list