11.2. Creating floating IPs¶
POST /v2.0/floatingips
Create a floating IP.
You can obtain the required floating_network_id
and subnet_id
from a request to v2.0/networks?provider:physical_network=Public
.
The status will change to ACTIVE
after a while.
Source: https://docs.openstack.org/api-ref/network/v2/index.html#create-floating-ip
11.2.1. Request¶
Name | In | Type | Description |
---|---|---|---|
floatingip |
body | object | A floatingip object. When you associate a
floating IP address with a VM, the instance has the same public IP
address each time that it boots, basically to maintain a
consistent IP address for maintaining DNS assignment. |
tenant_id |
body | string | The ID of the project. |
project_id |
body | string | The ID of the project. |
floating_network_id |
body | string | The ID of the network associated with the floating IP. |
fixed_ip_address (Optional) |
body | string | The fixed IP address that is associated with the floating IP.
If an internal port has multiple associated IP addresses,
the service chooses the first IP address unless you explicitly
define a fixed IP address in the fixed_ip_address parameter. |
floating_ip_address (Optional) |
body | string | The floating IP address. |
port_id (Optional) |
body | string | The ID of a port associated with the floating IP. To associate the floating IP with a fixed IP at creation time, you must specify the identifier of the internal port. |
subnet_id (Optional) |
body | string | The subnet ID on which you want to create the floating IP. |
description (Optional) |
body | string | A human-readable description for the resource. Default is an empty string. |
dns_domain (Optional) |
body | string | A valid DNS domain. |
dns_name (Optional) |
body | string | A valid DNS name. |
11.2.1.1. Example¶
# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{
"floatingip": {
"floating_network_id": "b4907761-8c0f-447e-9cfe-c688ca6e44a0",
"port_id": "165d5ff3-d015-4361-9bce-d59054c585cf",
"subnet_id": "351884c7-ee37-4a7d-9dcb-4cff4a1bba27"
}
}' https://<node_IP_addr>:9696/v2.0/floatingips
11.2.2. Response¶
Name | In | Type | Description |
---|---|---|---|
floatingip |
body | object | A floatingip object. When you associate a
floating IP address with a VM, the instance has the same public IP
address each time that it boots, basically to maintain a
consistent IP address for maintaining DNS assignment. |
router_id |
body | string | The ID of the router for the floating IP. |
status |
body | string | The status of the floating IP. Values are
ACTIVE , DOWN and ERROR . |
description |
body | string | A human-readable description for the resource. |
dns_domain |
body | string | A valid DNS domain. |
dns_name |
body | string | A valid DNS name. |
port_details |
body | string | The information of the port that this floating IP associates with.
In particular, if the floating IP is associated with a port, this field
contains some attributes of the associated port, including name ,
network_id , mac_address , admin_state_up , status ,
device_id and device_owner . If the floating IP is not associated
with a port, this field is null . |
tenant_id |
body | string | The ID of the project. |
created_at |
body | string | Time at which the resource has been created (in UTC ISO8601 format). |
updated_at |
body | string | Time at which the resource has been updated (in UTC ISO8601 format). |
revision_number |
body | integer | The revision number of the resource. |
project_id |
body | string | The ID of the project. |
floating_network_id |
body | string | The ID of the network associated with the floating IP. |
fixed_ip_address |
body | string | The fixed IP address that is associated with the floating IP address. |
floating_ip_address |
body | string | The floating IP address. |
port_id |
body | string | The ID of a port associated with the floating IP. |
id |
body | string | The ID of the floating IP address. |
tags |
body | array | The list of tags on the resource. |
port_forwardings |
body | array | The associated port forwarding resources for the floating IP. If the
floating IP has multiple port forwarding resources, this field has
multiple entries. Each entry consists of network IP protocol
(protocol ), the fixed IP address of internal neutron port
(internal_ip_address ), the TCP or UDP port used by internal
neutron port (internal_port ) and the TCP or UDP port used by
floating IP (external_port ). |
11.2.2.1. Status codes¶
11.2.2.1.1. Success¶
Code | Reason |
---|---|
201 - Created |
Resource was created and is ready to use. |
11.2.2.1.2. Error¶
Code | Reason |
---|---|
400 - Bad Request |
Some content in the request was invalid. |
401 - Unauthorized |
User must authenticate before making a request. |
404 - Not Found |
The requested resource could not be found. |
409 - Conflict |
This operation conflicted with another operation on this resource. |
The operation returns the Bad Request (400)
response code for one of
reasons:
- The network is not external, such as
router:external=False
.- The internal OpenStack Networking port is not associated with the floating IP address.
- The requested floating IP address does not fall in the subnet range for the external network.
- The fixed IP address is not valid.
If the port ID is not valid, this operation returns 404
response code.
The operation returns the Conflict (409)
response code for one of
reasons:
- The requested floating IP address is already in use.
- The internal OpenStack Networking port and fixed IP address are already associated with another floating IP.
11.2.2.2. Example¶
{
"floatingip": {
"router_id": "02542148-44cb-470d-a551-58f370c47b83",
"status": "DOWN",
"description": "",
"tags": [],
"tenant_id": "f5d834d636c642c7bfe8af86139c6f26",
"created_at": "2020-03-05T11:40:28Z",
"updated_at": "2020-03-05T11:40:28Z",
"floating_network_id": "b4907761-8c0f-447e-9cfe-c688ca6e44a0",
"port_details": {
"status": "ACTIVE",
"name": "",
"admin_state_up": true,
"network_id": "c4e2f31b-fe3b-402b-ac1b-b182693f72f7",
"device_owner": "compute:nova",
"mac_address": "fa:16:3e:66:ab:b3",
"device_id": "e1ae6f7e-c35d-4656-a4fd-2371f9a791d4"
},
"fixed_ip_address": "192.168.0.112",
"floating_ip_address": "10.94.139.174",
"revision_number": 0,
"project_id": "f5d834d636c642c7bfe8af86139c6f26",
"port_id": "165d5ff3-d015-4361-9bce-d59054c585cf",
"id": "f32947e7-8844-4eb2-a496-ef5653380584"
}
}
Version 5.0.0 — Feb 01, 2022