Manually associating floating IPs to instances
OpenStack Networking allocates floating IP addresses to all projects (tenants) from the same IP ranges. Where floating IPs are configured in a deployment, each project will have a limited number of floating IPs controlled by a quota. However, these need to be allocated to the project from the central pool prior to their use—usually by the administrator of the project.
When you create an OpenStack instance, the self-service portal displays all associated fixed IP addresses and any floating IP addresses on the instance. You can use the self-service portal to associate a floating IP address to a fixed IP address on the OpenStack instance. A floating IP address allows the instance to be publicly accessible. Each instance, has a private, fixed IP address and can also have a public, or a floating IP address.
Floating IP addresses allow you to direct ingress network traffic to your OpenStack instances. They are associated with instances in addition to their fixed IP addresses. Unlike fixed IP addresses, floating IP addresses are able to have their associations modified at any time, regardless of the state of the instances involved.
* Define a pool of floating IP addresses.
* Reserve a specific floating IP address from the pool.
* Associate the reserved floating IP address with the instance.
* A pool of floating IP addresses, configured by the cloud administrator, is available in OpenStack Compute. The project quota defines the maximum number of floating IP addresses that you can allocate to the project. After you allocate a floating IP address to a project, you can:
* Associate the floating IP address with an instance of the project. Only one floating IP address can be allocated to an instance at any given time.
* Disassociate a floating IP address from an instance in the project.
* Delete a floating IP from the project, which automatically deletes that IP’s associations.
Subscribe to our youtube channel to get new updates..!
When an instance boots, it is assigned a private IP address. This IP range is only accessible within our virtual environment’s network. To access this instance to serve the rest of the network or the public, we need to assign it a floating IP, which is the range we configure when we set up public IP ranges.
There are two ways to allocate floating IPs to instances: either automatically, as the instance is spawned, or manually through our client tools. In both cases, our tenancy must have a range of floating IPs assigned to it so they can be allocated.
To begin with, ensure you’re logged in to the Controller server (our OpenStack VirtualBox Virtual Machine, controller, created in the Keystone Openstack Identity Service). If this was created using Vagrant, you can log into this box using the following command:
To allocate a floating IP to an instance, ensure you’re logged in to a client that is running Nova Client.
How to accomplish it…
To assign a floating (public) IP address to an instance using Nova Client, carry out the following steps:
We are now able to communicate with that instance using this assigned floating IP address.
How it works…
Instances are not automatically accessible outside of the OpenStack host unless a public IP address is attached to it. Manually associating an address consists of the following two steps:
* Allocating an address from the available IP range.
* Associating the address with an instance.
This is an important concept, as it allows you to control the allocation of IP addresses as well as allocating specific addresses to specific instances, which is very much like Amazon’s Elastic IP feature.
Manually disassociating floating IPs from instances
In our cloud environment, we have the ability to add and remove access to and from the instance, publicly by adding or removing a floating IP address to or from it. This flexibility allows us to move services seamlessly between instances. To the outside world, it would appear to be the same instance, as their access to it is via that IP that has not changed.
To begin with, ensure you are logged into a client machine with Nova Client installed.
How to do it…
To disassociate a public (floating) address from an instance using Nova Client, carry out the following steps:
- This immediately removes the association with this address from the instance.
If we no longer require that floating IP address for our project, we can remove it from our project’s pool by issuing the following command:
nova floating-ip-delete 172.16.1.1
How it works…
Removing a floating IP address is very straightforward. When using Nova Client, we use the remove-floating-ip option to the nova command.