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.
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.
[Related Article: Installing OpenStack Dashboard]
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.
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:
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.
To disassociate a public (floating) address from an instance using Nova Client, carry out the following steps:
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
Removing a floating IP address is very straightforward. When using Nova Client, we use the remove-floating-ip option to the nova command.
Ravindra Savaram is a Content Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.