Multiple Network Interfaces
Private PaaS (PPaaS) allows any number of floating IPs to be assigned to any network interface of your cartridge's VM. This feature is only for the Openstack IaaS with a neutron networking environment. PPaaS leverages jclouds' openstack-neutron networking APIs to implement this feature. PPaaS also supports the Openstack IaaS with nova a networking environment, by leveraging jclouds' openstack-nova networking APIs.
Setting the OpenStack networking API
OpenStack has the following two network APIs: Neutron and Nova. Follow the instructions below to set the OpenStack networking API:
Step 1 - Define the OpenStack networking API
 Use the cloud-controller.xml
 to directly set the networking API as follows:
<iaasProvider type="openstack" name="openstack specific details"> <className>org.apache.stratos.cloud.controller.iaases.OpenstackNovaIaas</className> <provider>openstack-nova</provider> ------ <property name="openstack.networking.provider" value="neutron" />
The openstack.networking.provider
property can be either set to nova or neutron. The default is nova. If you set any other value for this property, other than one of the two OpenStack networking APIs, the default API will be used.
Step 2 - Set the autoAssignIp property
The autoAssignIp
property needs to be set to false in either one of the following methods:
Set via the cartridge definition.
"property":[ { "name":"keyPair", "value":"raj" }, { "name":"autoAssignIp", "value":"false" } ---- ]
Set via theÂ
cloud-controller.xml
 file.<property name="autoAssignIp" value="false" />
Specifying network interfaces in the base image
Your cartridge base image should contain multiple interface entries in the /etc/network/interfaces
file to be able to ping
or ssh
the floating IP associated with network interface. The number of entries in the /etc/network/interfaces
 file will depend on the number of network interfaces that you define.Â
Example: If you want to assign a floating IP to eth1
, then your cartridge base image's /etc/network/interfaces
file will have the following entries:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet dhcp
This entry in the /etc/network/interfaces
file will allow you to ping
or ssh
 the floating IP associated with eth1
. If you want to associate a floating IP to eth2
, you should add another entry in the /etc/network/interfaces
file.
Specifying network interfaces in a cartridge deployment JSON
You can specify multiple network interfaces with internal and floating networks, and/or fixed private and floating IPs in the cartridge deployment. You need to define a floating networks for each network interface. One network interface can have several floating networks. A floating network can be defined for several network interfaces as well.
The VM instances that you create from this cartridge subscription gets one private IP per network interface from the internal network, and floating IPs per floating network. If you define fixed floating IPs instead of network UUIDs, floating IPs are associated to the corresponding network interfaces.
Sample
The following is the interfaces section of a sample cartridge definition:
"networkInterfaces": [ { "networkUuid": "68aab21d-fc9a-4c2f-8d15-b1e41f6f7bb8" }, { "networkUuid": "512e1f54-1e85-4dac-b2e6-f0b30fc552cf", "floatingNetworks": [ { "name": "externalOne", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c" } ] }, { "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalThree", "floatingIP": "192.168.17.227" } ] }, { "networkUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalThree", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c", "floatingIP": "192.168.17.227" } ] }, { "portUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "fixedIp": "10.5.62.3", "floatingNetworks": [ { "name": "externalThree", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c", "floatingIP": "192.168.17.227" } ] }, { "networkUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalOne", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c", "floatingIP": "192.168.17.227" }, { "name": "externalTwo", "networkUuid": "sddsdsd-7ba8-4b24-b360-b74a0211c83c", } ] } ]
Example Scenarios
The following sections explain various multiple network interface scenarios together with examples.
Scenario 1
Floating networks are optional.
Example: Interface eth0
 will get a private IP from 68aab21d-fc9a-4c2f-8d15-b1e41f6f7bb8
.
{ "networkUuid": "68aab21d-fc9a-4c2f-8d15-b1e41f6f7bb8" }
Scenario 2
The floating networks' networkUuid
can be specified. A floating IP is assigned to the the interface from the given floating network. If there are any unassigned floating IPs in the given floating network, one is randomly chosen and assign to the interface. If not, a floating IP is allocated from the given floating network and assigned to the interface.
Example: Interface eth1
 gets a private IP from 512e1f54-1e85-4dac-b2e6-f0b30fc552cf
and a floating IP from ba667f72-7ba8-4b24-b360-b74a0211c83c
.
{ "networkUuid": "512e1f54-1e85-4dac-b2e6-f0b30fc552cf", "floatingNetworks": [ { "name": "externalOne", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c" } ] }
Scenario 3
You can specify a floating IP, which is considered as fixed floating IPs. PPaaS, checks whether the given IP is available for allocation. If it is available, PPaaS associates it with the interface. Otherwise, PPaaS throws an exception.
Example: Interface eth2
 is allocated a private IP from b55f009a-1cc6-4b17-924f-4ae0ee18db5e,
 and if the 192.168.17.227
 IP is available, PPaaS assigns it as a floating IP to the interface.
{ "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalThree", "floatingIP": "192.168.17.227" } ] }
Scenario 4
Both networkUuid
and a fixed floating IP can be specified. The networkUuid
will get higher priority over the fixed floating IP.
Example:Â Interface eth3
will get a private IP from d343d343-1cc6-4b17-924f-4ae0ee18db5e
and a floating IP from ba667f72-7ba8-4b24-b360-b74a0211c83c
. Based on the availability of the IP it might be assigned the 192.168.17.227
IP.
{ "networkUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalThree", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c", "floatingIP": "192.168.17.227" } ] }
Scenario 5
Any number of floating networks can be specified for a network interface. One floating IP per floating network will be associated to the corresponding interface. This scenario is supported from PPaaSÂ side. Due to the unavailability of an OpenStack environment with several floating networks, it is yet to be confirmed that OpenStack will also support this scenario.
Example: Interface eth5
will get a private IP from d343d343-1cc6-4b17-924f-4ae0ee18db5e
and a floating IP from ba667f72-7ba8-4b24-b360-b74a0211c83c
and another floating IP from sddsdsd-7ba8-4b24-b360-b74a0211c83c
.
Â
{ "networkUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalOne", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c", "floatingIP": "192.168.17.227" }, { "name": "externalTwo", "networkUuid": "sddsdsd-7ba8-4b24-b360-b74a0211c83c", } ] }
Scenario 6
Both private IPs and floating IPs can be predefined. If available they will be associated, otherwise an exception will be thrown.
Example:Â Interface eth5
will get a fixed private IP 10.5.62.3
and a fixed floating IP 192.168.17.227
. If atleast one of the IPs are unavailable, an exception will be thrown.
{ "portUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "fixedIp": "10.5.62.3", "floatingNetworks": [ { "name": "externalThree", "floatingIP": "192.168.17.227" } ] }
Scenario 7
Predefined floating IPs will be reserved if there are multiple floating networks defined for a cartridge. Therefore, in such a scenario an interface is guaranteed to have the floating IP that is defined to it.
Example:Â Floating IP 192.168.17.227
will be reserved for interface eth5.
 In the event eth1'
s allocation takes place first, eth1
will not get 192.168.17.227
. If 192.168.17.227
is available, it will be definitely assigned to eth5
.
{ "networkUuid": "512e1f54-1e85-4dac-b2e6-f0b30fc552cf", "floatingNetworks": [ { "name": "externalOne", "networkUuid": "ba667f72-7ba8-4b24-b360-b74a0211c83c" } ] }, { "portUuid": "d343d343-1cc6-4b17-924f-4ae0ee18db5e", "fixedIp": "10.5.62.3", "floatingNetworks": [ { "name": "externalThree", "floatingIP": "192.168.17.227" } ] }