Create Floating IP

Verb URI Description
POST /floatingips Creates a floating IP, and configures its association with an internal port, if the relevant information are specified

Normal Response Code: 200 OK

Error Response Code: 400 Bad Request, 401 Unauthorized, 409 Conflict

This operation requires a request body.

This operation returns a response body.

This operation creates a floating IP. Users can specify association information for this floating IP in the request body. These information are however optional, and can be specified with an UPDATE call at a later stage. The only mandatory parameter in the request body is the external network identifier, floating_network_id. Floating IPs can only be created on external networks. If the network specified by floating_network_id is not external (for example, router:external=False), a 400 error is returned.

An address for the floating ip will be automatically allocated, unless the floating_ip_address attribute is specified in the request body. If the requested floating IP address does not fall in the external network's subnet range, a 400 error will be returned. If the requested floating IP address is already in use, a 409 error code will be returned.

Users can associate the floating IP with an internal port using the port_id attribute in the request body. If an invalid port identifier is specified, a 404 error will be returned. The internal OpenStack Networking port associated with the Floating IP must have at least an IP address configured, otherwise a 400 error will be returned.

As an OpenStack Networking port might be associated with multiple IP addresses, the particular IP address to associate with the floating IP can be specified using the fixed_ip_address request body parameter. The default logic of this operation is to associate the floating IP with a single IP address configured on a port; hence, if a port has multiple IP addresses, it is mandatory to specify the fixed_ip_address attribute. If an invalid IP address is specified in fixed_ip_address a 400 error will be returned.

If the internal OpenStack Networking port and ip address selected for association are already associated to another floating IP, a 409 error will be returned.

 

Example 4.30. Create Floating IP: JSON Request

POST /v2.0/floatingips
Accept: application/json

{
    "floatingip":
    {
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab"
     }
}

 

Example 4.31. Create Floating IP: JSON Response

{
    "floatingip":
    {
        "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",
        "tenant_id": "4969c491a3c74ee4af974e6d800c62de",
        "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",
        "fixed_ip_address": "10.0.0.3",
        "floating_ip_address": "172.24.4.228",
        "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
        "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7"
     }
}

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page


loading table of contents...