I assign a fixed IP to an interface in the heat template.
private_port_1:
type: OS::Neutron::Port
properties:
network: { get_param: private_net }
fixed_ips: [{"subnet": { get_param: private_subnet }, "ip_address": { get_param: private_ip_1 }}]
my_vm_123:
type: OS::Nova::Server
properties:
image: { get_param: image_name }
flavor: { get_param: flavor_name }
name: { get_param: vm_name }
networks:
- network: { get_param: public_net }
- port: { get_resource: private_port_1 }
The VM is successfully instantiated and its private IP (private_ip_1) is shown in the Horizon GUI. However, the "eth1" appears to be down and the /etc/network/interfaces contains configuration only for the public "eth0".
I can do a workaround by manually populating "/etc/network/interfaces" and turning the eth1 on in the "user_data:" part. The question is - is this the way it should be or there is something wrong with my heat or Openstack that prevents eth1 to be configured automatically?
Thanks! Michael.
Yes, it is the way it should be. OpenStack (Nova, Neutron) sets up the VM and provides right connectivity. However, the operation system running in the VM has to bring up the interfaces. Default cloud-init images are hardcoded to bring up only eth0 (with DHCP). So, you have to explicitly bring up eth1 in your VM.
You can use user_data variable of OS::Nova::Server resource type to run custom scripts when bringing up a VM. I had a similar use case where I needed to bring up eth1 automatically. You can check on how I achieved this at https://github.com/ypraveen/openstack-installer/blob/master/vm-heat-template/devstack.yaml
Line 33 shows the usage of user_data. You can check the lines 41-45 in the init script that bring up eth1: https://github.com/ypraveen/openstack-installer/blob/master/vm-heat-template/devstack_vm_init.sh