---
title: "Public floating IP addresses"
sidebar_label: "Public floating IP addresses"
sidebar_position: 9
description: "How to create a public floating IP address, prepare a private subnet for connecting a public floating IP address, and other instructions"
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'
import TrashIcon from '@selectel/docux/icons/trash'
import EditIcon from '@selectel/docux/icons/edit'
import CreatePublicFloatingIp from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/cloud-servers/cloud-networks/create-public-floating-ip.mdx'
import CreateCloudRouterWithExternalIP from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/cloud-servers/cloud-networks/create-cloud-router-with-external-ip.mdx'
import ConnectPrivateSubnetToCloudRouter from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/cloud-servers/cloud-networks/connect-private-subnet-to-cloud-router.mdx'
import ConnectPublicIpToLoadBalancerOpenstack from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/cloud-servers/cloud-networks/connect-public-ip-to-load-balancer-openstack.mdx'
import DisconnectPublicIpFromLoadBalancerOpenstack from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/cloud-servers/cloud-networks/disconnect-public-ip-from-load-balancer-openstack.mdx'
import DisconnectPublicIpFromAnyPortPanel from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/cloud-servers/cloud-networks/disconnect-public-ip-from-any-port-panel.mdx'
import Formbricks from '@theme/MDXComponents/Formbricks'

# Public floating IP addresses

Public floating IP addresses are static IP addresses that can be connected to devices in private networks to configure access to them from the Internet: a [cloud server](#connect-public-floating-ip-to-cloud-server), [load balancer](#connect-public-floating-ip-to-load-balancer), [Managed Database cluster](#connect-public-floating-ip-to-dbaas).

The address is a floating one (Floating IP in the API), as it can be quickly [switched between devices](#switch-public-floating-ip) in private subnets. The address does not change or get deleted when switched.

To connect a public floating IP address, the device must be in a private subnet connected to a cloud router with internet access — see the [Prepare a private subnet to connect a public floating IP address](#configure-subnet-for-internet-access) instruction for details. A public floating IP address is associated with the private IP address of a device. Incoming traffic is handled by the cloud router — the router performs 1:1 NAT via an external IP address, which is allocated when the router is connected to the internet. Incoming traffic can be filtered using a [cloud firewall](/cloud-servers/firewalls/) or a [security group](/cloud-servers/security-groups/).

When created, a public floating IP address is automatically allocated from the address pool; it cannot be selected manually.

A public floating IP address can only be used within the same [project](/access-control/projects/about-projects.mdx) and the same [pool](/infrastructure/locations.mdx#pool).

For public floating IP addresses, there are traffic volume limitations, i.e., bandwidth. You can view them in the [Bandwidth](/cloud-servers/cloud-networks/about-networks.mdx#bandwidth) table.

You can work with public floating IP addresses in the [Control panel](https://my.selectel.ru/vpc/default/networks/), using [OpenStack CLI](/cloud-servers/tools/openstack-cli/) or [Terraform](/terraform/providers/).

## Create a public floating IP address \{#create-public-floating-ip}

If you are creating the first public floating IP address in a [project](/access-control/projects/about-projects.mdx) and [pool](/infrastructure/locations.mdx#pool), a private network named `nat` and a cloud router named `router-nat`.

<CreatePublicFloatingIp />

## Prepare a private subnet for connecting a public floating IP address⁠ \{#configure-subnet-for-internet-access}

To configure access to and from the internet via a public floating IP address, you must connect it to a device.

The device must be in a private subnet that meets the following requirements:

* the subnet must be connected to a cloud router that is connected to the internet. If the cloud router is connected to the internet, it performs 1:1 NAT for access from the private network to the internet via the router's external address and for access to the device in the private subnet from the internet via the public floating IP address;
* the private IP address of the cloud router must match the default gateway in the subnet.

If the subnet does not meet the requirements, prepare it for connecting a public floating IP address:

1. [Create a cloud router with an internet connection⁠](#create-cloud-router).
2. [Connect the private subnet to the cloud router](#connect-private-subnet-to-cloud-router).

### 1. Create a cloud router with an internet connection⁠ \{#create-cloud-router}

<CreateCloudRouterWithExternalIP />

### 2. Connect the subnet to the cloud router \{#connect-private-subnet-to-cloud-router}

<ConnectPrivateSubnetToCloudRouter />

## Connect a public floating IP address to a cloud server \{#connect-public-floating-ip-to-cloud-server}

A public floating IP address can be connected when [creating a cloud server](/cloud-servers/create/create-server.mdx) or to an already created server.

<Tabs queryString="connect-public-floating-ip-to-cloud-server">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. Make sure the cloud server is in a subnet that meets the requirements. For more details, see the [Preparing a private subnet for connecting a public floating IP address](#configure-subnet-for-internet-access) subsection. You can view server subnets in the [control panel](https://my.selectel.ru/vpc/default/servers/): in the top menu, click **Products** → **Cloud Servers** → server page → **Ports** tab.
    2. In the [Control panel](https://my.selectel.ru/vpc/default/floating-ips/), in the top menu, click **Products** and select **Cloud Servers**.
    3. Go to the **Network** section → **Public floating IP addresses** tab.
    4. In the public floating IP address card, click <EditIcon />.
    5. Select the cloud server private IP address.
    6. Click **Save**.
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open OpenStack CLI](/cloud-servers/tools/openstack-cli/).

    2. View the cloud server port ID:

       ```bash
       openstack port list --server <server>
       ```

       Specify `<server>` — the ID or name of the cloud server.

    3. Connect a public floating IP address to the cloud server port:

       ```bash
       openstack floating ip set --port <port> <floating_ip_address>
       ```

       Specify:

       * `<port>` — the cloud server port ID;
       * `<floating_ip_address>` — the ID or public floating IP address; you can view it using the command `openstack floating ip list`.
  </TabItem>
</Tabs>

## Disconnect a public floating IP address from a cloud server \{#disconnect-public-floating-ip-from-cloud-server}

<Tabs queryString="disconnect-public-floating-ip-from-cloud-server">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    <DisconnectPublicIpFromAnyPortPanel />
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open OpenStack CLI](/cloud-servers/tools/openstack-cli/).
    2. Disconnect the public floating IP address from the cloud server port:

       ```bash
       openstack floating ip unset --port <floating_ip_address>
       ```

       Specify `<floating_ip_address>` — the ID or public floating IP address; you can view it using the command `openstack floating ip list`.
  </TabItem>
</Tabs>

## Connect a public floating IP address to a load balancer \{#connect-public-floating-ip-to-load-balancer}

A public floating IP address can be connected when [creating a load balancer](/cloud-servers/load-balancers/create-load-balancer.mdx) or to an existing load balancer.

<Tabs queryString="connect-public-floating-ip-to-load-balancer">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. Make sure the load balancer is on a subnet that meets the requirements; for more details, see the [Prepare a private subnet to connect a public floating IP address](/cloud-servers/cloud-networks/public-floating-ip-addresses.mdx#configure-subnet-for-internet-access). You can view the load balancer subnets in the [Control Panel](https://my.selectel.ru/vpc/default/lbaas/): from the top menu, click **Products** → **Cloud Servers** → **Load Balancers** → tab **Load Balancers** → load balancer page → block **Settings** → field **Network**.
    2. In the [Control Panel](https://my.selectel.ru/vpc/default/lbaas/), from the top menu, click **Products** and select **Cloud Servers**.
    3. Go to the **Network** section.
    4. Open the **Public floating IP addresses** tab.
    5. In the public floating IP address card, click <EditIcon />.
    6. Select the load balancer private IP address.
    7. Click **Save**.
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    <ConnectPublicIpToLoadBalancerOpenstack />
  </TabItem>
</Tabs>

## Disconnect a public floating IP address from a load balancer \{#disconnect-public-floating-ip-from-load-balancer}

<Tabs queryString="disconnect-public-floating-ip-from-load-balancer">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    <DisconnectPublicIpFromAnyPortPanel />
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    <DisconnectPublicIpFromLoadBalancerOpenstack />
  </TabItem>
</Tabs>

## Connect a public floating IP address to a Managed Database cluster \{#connect-public-floating-ip-to-dbaas}

A public floating IP address can be connected when [creating a database cluster (example for PostgreSQL](/managed-databases/postgresql/create-cluster.mdx)) or to an existing cluster.

<Tabs queryString="connect-public-floating-ip-to-dbaas">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. Make sure the cloud database cluster is on a subnet that meets the requirements; for more details, see the [Prepare a private subnet to connect a public floating IP address](#configure-subnet-for-internet-access). You can view the cluster subnets in the [Control Panel](https://my.selectel.ru/vpc/default/dbaas/): from the top menu, click **Products** → **Managed Databases** → cluster page → tab **Settings** → field **Cluster network**.
    2. In the [Control Panel](https://my.selectel.ru/vpc/default/dbaas/), from the top menu, click **Products** and select **Managed Databases**.
    3. Go to the **Network** → tab **Public floating IP addresses**.
    4. In the public floating IP address card, click <EditIcon />.
    5. Select the node private IP address.
    6. Click **Save**.
  </TabItem>
</Tabs>

## Disconnect a public floating IP address from a Managed Database cluster \{#disconnect-public-floating-ip-from-dbaas}

<Tabs queryString="disconnect-public-floating-ip-from-dbaas">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. In the [Control Panel](https://my.selectel.ru/vpc/default/dbaas/), from the top menu, click **Products** and select **Managed Databases**.
    2. Go to the **Network** → tab **Public floating IP addresses**.
    3. In the public floating IP address card, click <EditIcon />.
    4. In the **New private address for traffic NAT** field, select **Disconnect from current**.
    5. Click **Save**.
  </TabItem>
</Tabs>

## Switch a public floating IP address between devices \{#switch-public-floating-ip}

<Tabs queryString="switch-public-floating-ip">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. In the [Control Panel](https://my.selectel.ru/vpc/default/networks), from the top menu, click **Products** and select **Cloud Servers**.
    2. Go to the **Network** → tab **Public floating IP addresses**.
    3. In the public floating IP address card, click <EditIcon />.
    4. Select a new private IP address for traffic NAT.
    5. Click **Save**.
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open OpenStack CLI](/cloud-servers/tools/openstack-cli/).

    2. Disconnect the public floating IP address from the current private IP address:

       ```bash
       openstack floating ip unset --port <floating_ip_address>
       ```

       Specify `<floating_ip_address>` — the public floating IP address.

    3. Copy the port ID with the private IP address to which you need to connect the public floating IP address. To do this, list the ports:

       ```bash
       openstack port list
       ```

       In the port row, copy the value in the `ID` field.

    4. Connect the public floating IP address to the private IP address:

       ```bash
       openstack floating ip set --port <port> <floating_ip_address>
       ```

       Specify:

       * `<port>` — the port ID you copied in step 3;
       * `<floating_ip_address>` — the ID or public floating IP address; you can view it using the command `openstack floating ip list`.
  </TabItem>
</Tabs>

## Configure NAT \{#configure-nat}

To configure NAT, you need to perform port forwarding — configure traffic redirection from one port to another. For example, you can configure port forwarding on a public floating IP address to any port in the private subnet; in this case, access to the private port will be organized without creating an additional public floating IP address.

Before you start configuring port forwarding, the public floating IP address must not be associated with a cloud server, load balancer, or other devices.

By default, Selectel [blocks certain TCP/UDP ports](/infrastructure/blocked-ports.mdx), and traffic through them is blocked.

<Tabs queryString="configure-nat">
  <TabItem value="openstack" default>
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open OpenStack CLI](/cloud-servers/tools/openstack-cli/).
    2. Configure port forwarding:

       ```bash
       openstack floating ip port forwarding create \
         --internal-ip-address <internal_ip_address> \
         --port <port> \
         --internal-protocol-port <internal_protocol> \
         --external-protocol-port <external_protocol> \
         --protocol <protocol> \
         <floating_ip_address>
       ```

       Specify:

       * `<internal_ip_address>` — the IP address of the port in the private subnet that traffic will be forwarded to;
       * `<port>` — the ID or name of the port in the private network that traffic will be forwarded to; you can view it using the command `openstack port list`;
       * `<internal_protocol>` — the port protocol in the private subnet;
       * `<external_protocol>` — the protocol of the public floating IP address port being forwarded;
       * `<protocol>` — the protocol: `tcp` or `udp`;
       * `<floating_ip_address>` — the ID or public floating IP address whose port is being forwarded. You can view it using the command `openstack floating ip list`.

       Command example:

       ```bash
       openstack floating ip port forwarding create \
         --internal-ip-address 192.168.0.2 \
         --port ed010217-9f78-4002-8703-2112da3fef1f \
         --internal-protocol-port 80 \
         --external-protocol-port 80 \
         --protocol tcp \
         192.0.2.7
       ```
  </TabItem>
</Tabs>

## Delete a public floating IP address \{#delete-public-floating-ip}

After deletion, the public floating IP address will be returned to the pool of public floating addresses.

<Tabs queryString="delete-public-floating-ip">
  <TabItem value="panel" default>
    <TabItemLabel>
      Control panel
    </TabItemLabel>

    1. In the [Control Panel](https://my.selectel.ru/vpc/default/networks/), from the top menu, click **Products** and select **Cloud Servers**.
    2. Go to the **Network** → tab **Public floating IP addresses**.
    3. In the public floating IP address card, click <TrashIcon />.
    4. Enter the IP address to confirm deletion.
    5. Click **Delete**.
  </TabItem>

  <TabItem value="openstack">
    <TabItemLabel>
      OpenStack CLI
    </TabItemLabel>

    1. [Open OpenStack CLI](/cloud-servers/tools/openstack-cli/).
    2. Delete the public floating IP address:

       ```bash
       openstack floating ip delete <floating_ip_address>
       ```

       Specify `<floating_ip_address>` — the ID or public floating IP address; you can view it using the command `openstack floating ip list`.
  </TabItem>
</Tabs>

<Formbricks />
