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

Kaustubh Kelkar kaustubh.kelkar at casa-systems.com
Thu Jul 21 20:42:03 UTC 2016


I would have hoped the documentation (http://docs.openstack.org/user-guide/cli_config_drive.html#enable-and-access-the-configuration-drive) was clear on this. It shows how one can configure IP addresses by injecting /etc/network/interfaces file for a DHCP disabled network, but does not seem to mention how one will know what to write in that file.

Perhaps a note could be added on the doc page (?)


Thanks,
Kaustubh

From: Brent Troge [mailto:brenttroge2016 at gmail.com]
Sent: Thursday, July 21, 2016 4:17 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

yeah.. my notes do the same as what you suggest.
1. create your neutron ports
2. pass port attributes to user-data script

or use cloud-config as per the below.

https://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files


On Thu, Jul 21, 2016 at 2:18 PM, Kaustubh Kelkar <kaustubh.kelkar at casa-systems.com<mailto: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<mailto:brenttroge2016 at gmail.com>]
Sent: Wednesday, July 20, 2016 7:27 PM
To: Kaustubh Kelkar <kaustubh.kelkar at casa-systems.com<mailto:kaustubh.kelkar at casa-systems.com>>
Cc: openstack at lists.openstack.org<mailto: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<mailto: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<mailto: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/0176150c/attachment.html>


More information about the Openstack mailing list