Apache Stratos 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. Stratos leverages jclouds' openstack-neutron networking APIs to implement this feature. Stratos also supports the Openstack IaaS with nova a networking environment, by leveraging jclouds' openstack-nova networking APIs.
OpenStack has the following two network APIs: Neutron and Nova. Follow the instructions below to set the OpenStack networking API:
Use one of the following methods to 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 any other value is set for this property, other than one of the two OpenStack networking APIs, the default API will be used.
If you are using the stratos-installer to setup Stratos, you can set the following parameter in the stratos-installer/conf/setup.conf
file under the OpenStack configurations as follows:
# Openstack export openstack_provider_enabled=false export openstack_identity="stratos:stratos" # Openstack project name:Openstack login user export openstack_credential="password" # Openstack login password export openstack_jclouds_endpoint="http://hostname:5000/v2.0" export openstack_keypair_name="" export openstack_security_groups="" export openstack_networking_provider="neutron"
The setup.sh
automatically adds the value of the openstack.networking.provider
property in the cloud-controller.xml
file, based on the value in the setup.conf
file.
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" />
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.
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.
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", } ] } ]
The following sections explain various multiple network interface scenarios together with examples.
Floating networks are optional.
Example: Interface eth0
will get a private IP from 68aab21d-fc9a-4c2f-8d15-b1e41f6f7bb8
.
{ "networkUuid": "68aab21d-fc9a-4c2f-8d15-b1e41f6f7bb8" }
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" } ] }
You can specify a floating IP, which is considered as fixed floating IPs. Stratos, checks whether the given IP is available for allocation. If it is available, Stratos associates it with the interface. Otherwise, Stratos 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, Stratos assigns it as a floating IP to the interface.
{ "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e", "floatingNetworks": [ { "name": "externalThree", "floatingIP": "192.168.17.227" } ] }
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" } ] }
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 Stratos 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", } ] }
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" } ] }
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" } ] }