• Home
  • Blog
  • OpenStack
  • Manually associating and dissociating floating IPs of instances – OpenStack

Manually associating and dissociating floating IPs of instances – OpenStack

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.

Manually Openstack associating and dissociating floating IPs of Instances 

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.

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:

Controller server

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

Assigning a Floating IP Address to an Instance in OpenStack

To assign a floating (public) IP address to an instance using Nova Client, carry out the following steps:

Nova Client

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:

  • 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.

Related Article: OpenStack Dashboard to launch instances

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.

Disassociating a Public Floating IPs From Instances 

To disassociate a public (floating) address from an instance using Nova Client, carry out the following steps:

Nova Client floating address
  • 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:

MindMajix YouTube Channel

nova floating-ip-delete 172.16.1.1

Removing a Floating Ip Address 

Removing a floating IP address is very straightforward. When using Nova Client, we use the remove-floating-ip option to the nova command.

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
OpenStack TrainingNov 23 to Dec 08View Details
OpenStack TrainingNov 26 to Dec 11View Details
OpenStack TrainingNov 30 to Dec 15View Details
OpenStack TrainingDec 03 to Dec 18View Details
Last updated: 03 Apr 2023
About Author

Ravindra Savaram is a Technical 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.

read less
  1. Share:
OpenStack Articles