# How to allocate floating IP addresses

Source: https://docs.quake.ai/docs/network/how-to/allocate-floating-ips
Markdown: https://docs.quake.ai/docs/network/how-to/allocate-floating-ips.md

---

# How to allocate floating IP addresses

Floating IPs are public IP addresses that you can assign to instances on private networks. Allocate a floating IP from the public pool, then associate it with an instance to make it reachable from the internet.



the Console surfaces this resource under three different labels:

- **Floating IPs** in the sidebar nav and as the list page heading at **Network** > **Floating IPs**.
- **Public IPs** in the Dashboard quota widget (for example, `2 / 4 Public IPs`).
- **IP** and **Allocate IP** on the Floating IPs list row and in the allocation dialog.

All three refer to the same resource.



<PrerequisiteBlock methods={["console", "cli", "api", "terraform"]}>

You need an instance on a [private network](/docs/network/how-to/create-network) with a [router](/docs/network/how-to/create-router) connected to the `PublicStatic` external network.

</PrerequisiteBlock>

## Allocate a floating IP

<MethodTabs>
<Method label="Console">

1. Select **Network** > **Floating IPs** > **Allocate IP**.
2. In the **Allocate IP** dialog, choose the source pool from the **Network** dropdown (for example, `PublicStatic`).
3. After you choose a **Network**, an optional **Owned Subnet** dropdown appears. Leave it blank to allocate from the network's default pool, or select a subnet to constrain which subnet inside the chosen network the floating IP comes from.
4. Optionally toggle **Batch Allocate** on to allocate multiple IPs at once. When the toggle is on, a required **Count** field appears; enter the number of floating IPs to allocate.
5. Optionally enter a **Description**.
6. Select **OK** to allocate.

</Method>
<Method label="CLI">

```bash
openstack floating ip create PublicStatic
```

The output includes the allocated `floating_ip_address` and its `id`.

</Method>
<Method label="API">

```bash
curl -X POST "$OS_NETWORK_URL/v2.0/floatingips" \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "floatingip": {
      "floating_network_id": "PUBLIC_STATIC_NETWORK_ID"
    }
  }'
```




```python
import openstack

conn = openstack.connect(cloud="rumble")

fip = conn.network.create_ip(floating_network_id="PUBLIC_STATIC_NETWORK_ID")
print(f"Floating IP: {fip.floating_ip_address} (id: {fip.id})")
```




</Method>
<Method label="Terraform">

```hcl
data "openstack_networking_network_v2" "public" {
  name = "PublicStatic"
}

resource "openstack_networking_floatingip_v2" "my_fip" {
  pool = data.openstack_networking_network_v2.public.name
}
```

</Method>
</MethodTabs>

## Associate the floating IP with an instance

<MethodTabs>
<Method label="Console">

1. Go to **Compute** > **Instances**.
2. Find your instance. The row exposes five action icons (**Console**, **Instance Status**, **Volumes**, **Networking**, **Settings**). Open the **Networking** icon dropdown and select **Associate Floating IP**.
3. In the **Instance IP** table, select the radio button next to the private IP listed for the instance. The **Floating IP Address** table populates only after you select an instance IP.
4. In the **Floating IP Address** table, select the radio button next to the floating IP you allocated. To allocate a new IP from this dialog instead, select **+ Allocate IP**.
5. Select **OK**.

</Method>
<Method label="CLI">

```bash
openstack server add floating ip MY_INSTANCE FLOATING_IP_ADDRESS
```

Alternatively, associate via the port directly:

```bash
openstack floating ip set --port MY_PORT_ID FLOATING_IP_ADDRESS
```

</Method>
<Method label="API">

```bash
curl -X PUT "$OS_NETWORK_URL/v2.0/floatingips/FLOATING_IP_ID" \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "floatingip": {
      "port_id": "INSTANCE_PORT_ID"
    }
  }'
```

</Method>
<Method label="Terraform">

```hcl
resource "openstack_compute_floatingip_associate_v2" "fip_assoc" {
  floating_ip = openstack_networking_floatingip_v2.my_fip.address
  instance_id = openstack_compute_instance_v2.my_instance.id
}
```

See the [simple VM template](/resources/iac-templates/simple-vm) for a complete example with floating IP allocation and association.

</Method>
</MethodTabs>

## Verify the result

<MethodTabs>
<Method label="Console">

Navigate to **Network** > **Floating IPs**. The floating IP row shows its associated **Fixed IP** (the instance's private IP) and **Associated Port** UUID, with **Status** moving from `Down` to `Active`. The list does not show the instance name. To see it, open **Compute** > **Instances**, where the floating IP appears under the instance's **Floating IP** column.

</Method>
<Method label="CLI">

```bash
openstack floating ip list
openstack server show MY_INSTANCE -c addresses
```

The floating IP appears in the instance's address list alongside the private IP.

</Method>
<Method label="API">

```bash
curl -s "$OS_NETWORK_URL/v2.0/floatingips?floating_ip_address=FLOATING_IP_ADDRESS" \
  -H "X-Auth-Token: $OS_TOKEN" | python3 -m json.tool
```

</Method>
<Method label="Terraform">

```bash
tofu show
```

</Method>
</MethodTabs>

## See also

- [How to point a domain at a Quake AI resource](/docs/network/how-to/point-domain-to-quake-ai)
- [Network API Reference](/reference/network): full parameter documentation for the Network API
- [Floating IPs CLI reference](/reference/network/floating-ip-cli)
- [Floating IPs API reference](/reference/network/floating-ip-api)
- [Floating IPs console](/reference/network/console/floating-ips)
- [Floating IPs concepts](/docs/network/concepts/floating-ips)
