For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt, and this page is available as Markdown at https://docs.us.ovhcloud.com/en/public-cloud/network-services/attach-floating-ip-to-instance.md.
  • English

Attaching a Floating IP to a Public Cloud instance

View as Markdown

Floating IPs are public IP addresses for Public Cloud, used to expose a private instance or a private network service to the public network. You can read more about it on our dedicated concepts page.

 

Requirements


OVHcloud Control Panel Access


 

Understanding the Floating IP service

Floating IP is one of the services delivered by the OpenStack DVR (Distributed Virtual Router) component of OVHcloud Public Cloud.

Floating IP lets you create a public IP address for your private-network-based VMs, handling both incoming and outgoing traffic. Floating IP addresses can be attached and detached from your VMs at any time.

You can hold Floating IP addresses without attaching them to any service. They remain available for your resources until they are manually deleted.

 

Target configuration architecture

Attach floating IP to instance - step 1

The goal of this exercise is to create a VM (vm4fip) with a private local network (test-network) only, and use a router (router1) to set up a Floating IP.

Next, you will use this Floating IP to connect to the instance (VM) from the outside and check its access to the Internet.

 

Instructions

Creation

Control Panel
OpenStack API
Horizon interface
OVHcloud API
OVHcloud CLI
In case of a new instance

Before creating your instance, make sure you have created a private network with Gateway.

To create a new instance, follow this guide if necessary.

Warning

NOTE: Not all regions support this feature. Make sure to create an instance in a valid region. For more information, please refer to our regions availability page.

In Step 5, you can choose a networking mode for your instance: Public or Private.

By default, the public mode is selected, but since you are creating an instance to which you will attach a Floating IP, you need to create an instance with a private network ONLY.

Select the Private mode and click on the drop-down list to select a private network of your choice (the network must have been previously created with a Gateway or linked to a Gateway).

If you select a private network that is not linked to a Gateway, the system will automatically create a Gateway of size "S" by default and attach it to your network.

In the next step, check the box next to Attach a Floating IP to this Instance, and select Create a new Floating IP.

When you have applied your choices, click Next to proceed to the final step and decide on a billing method.

Choose hourly billing if you are unsure about the usage period — you cannot switch to it after delivery. You will have the option to switch to a monthly subscription as soon as the instance is available on the "Instances" page.

Warning

NOTE: If you choose to be billed hourly, you will continue to be billed as long as the instance is not deleted. It does not matter if the instance is not actually used during this time.

Verify your configuration, then click Create an instance. It may take a few minutes until your service is delivered.

Network attachfloat - Attach floating IP to instance - step 1

In case of an existing instance (created with a private network only)

Please note that the private network must be linked to a Gateway. For more information, consult this guide: Creating a private network with Gateway.

Click on Public IPs in the left-hand menu under Network.

Click on Floating IP, then on Add a new IP.

Network attachfloat - Attach floating IP to instance - step 2

Underneath "Select your public use", select the Floating IPs (Public Cloud).

In the next step, choose a region for your Floating IPs. The region must be the same as that of the instance you wish to attach the Floating IP to.

Info

Please note that only regions in which this service is available will be displayed.

Next, click on the drop-down list to select the instance to attach the Floating IP to, then select the network/IP (this will be in the default range selected when creating the private network of the instance).

Info

In case your instance is attached to two or more private networks, you will be presented with an equal amount of private IPs to select from, select the private IP of your choice.

Once done, click on Generate purchase order. It may take a few minutes until your service is delivered.

Network attachfloat - Attach floating IP to instance - step 3

 

Adding a DNS to a Floating IP

OpenStack API
Info

Complete the 9 steps above before starting this procedure.

To add a DNS to a Floating IP, run the following command from the command line.

$ openstack floating ip set --dns-domain <DOMAIN_NAME> <IP_ADDRESS_ID>

 

Detachment

OpenStack API
Horizon interface
OVHcloud API

You can detach a Floating IP from your VM at any time.

$ openstack server remove floating ip vm4fip 169.254.10.25
$ openstack floating ip list
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
| ID                                   | Floating IP Address | Fixed IP Address | Port | Floating Network                     | Project                          |
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
| 7b646f78-9344-440e-83c1-57c828a03718 | 169.254.10.25       | None             | None | b2c02fdc-ffdf-40f6-9722-533bd7058c06 | 25a9e81103504980809e3f7573d93da3 |
+--------------------------------------+---------------------+------------------+------+--------------------------------------+----------------------------------+
$ ping 169.254.10.25
PING 169.254.10.25 (169.254.10.25) 56(84) bytes of data.
^C
--- 169.254.10.25 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1019ms
Warning

NOTE: Once a Floating IP is detached, it goes back to your pool of Floating IPs. The Floating IP can be reattached to the same VM or any other VMs in your VMs pool. Detaching a Floating IP does not delete it.

 

Deletion

Control Panel
OpenStack API
Horizon interface
OVHcloud API
OVHcloud CLI

Click on Public IPs in the left-hand menu under Network.

In the Floating IP tab, click on the more options ... next to the corresponding IP and select Delete.

Network attachfloat - Attach floating IP to instance - step 4

In the pop-up window, proceed with the deletion of the IP by clicking on Confirm.

 

Go further

Browse all the Networking guides.

Browse the rest of the OVHcloud US documentation for guides on our other products and services.

Learn more about Public Cloud Network on the OVHcloud US website.