Floating IPs (v2)

The base URL for this API is: https://api.leaseweb.com/floatingIps/v2/

Errors

The API uses standard HTTP status codes to indicate the success or failure of the API call. The response will be JSON. Most APIs use the following format:

{
"errorCode" : "APP00800",
"errorMessage" : "The connection with the DB cannot be established.",
"correlationId" : "550e8400-e29b-41d4-a716-446655440000",
"userMessage" : "Cannot handle your request at the moment. Please try again later.",
"reference" : "http://developer.leaseweb.com/errors/APP00800"
}

Authentication

Authentication for the APIs is required. To authenticate your call, you will need to sent your API key as X-LSW-Auth header.

You can generate API keys in the Customer Portal.

Floating IP ranges

Create and manage your Floating IP ranges and definitions

List ranges

A Floating IP range is bound to a particular site or metro.

If you have services in multiple data centers and want to use the Floating IP feature in each of those locations you will need to order a range per site or metro.

Authorizations:
X-LSW-Auth
query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

type
string
Enum: "SITE" "METRO"

Filter ranges by range type

location
string

Filter ranges by range location

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/floatingIps/v2/ranges?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&type=SOME_STRING_VALUE&location=SOME_STRING_VALUE' \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "ranges": [
    ],
  • "_metadata": {
    }
}

Inspect a range

A Floating IP range is identified by is network IP and the prefix length, separated by a underscore; for example 10.0.0.0_29.

Be aware that every IP address of a Floating IP range is usable and routable. A Floating IP range does not have a network IP, broadcast IP or gateway IP.

So for every IP in the range you can create a Floating IP Definition.

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29 \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "id": "88.17.0.0_17",
  • "range": "88.17.0.0/17",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "location": "AMS-01",
  • "type": "SITE"
}

List range definitions

A Floating IP definition describes a mapping between one or more Floating IPs (a.k.a Floating IP) to an anchor IP. Traffic destined for all the Floating IPs will be rerouted to the anchor IP.

The anchor IP is an ip address that belongs to a service you have with Leaseweb. At this moment only dedicated servers, dedicated racks and colocations are supported.

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

query Parameters
limit
integer
Default: 10

Limit the number of results returned

offset
integer
Default: 0

Return results starting from the given offset

location
string

Filter range definations by range location

type
string
Enum: "SITE" "METRO"

Filter range definations by range type

Responses

Request samples

curl --request GET \
  --url 'https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions?limit=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&location=SOME_STRING_VALUE&type=SOME_STRING_VALUE' \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "floatingIpDefinitions": [
    ],
  • "_metadata": {
    }
}

Create a range definition

When a Floating IP definition is created, the Floating IP address is then made to route all traffic to the anchor IP address, Hence all services on the server become reachable via the Floating IP. This works in the background by maintaining BGP sessions in each site which announce the Floating IP routes through the border routers.

Floating IP addresses which do not have an anchor IP address have no route, and are thus effectively nullrouted.

How to configure Floating IPs on a server

On the server, Floating IPs should be setup like any other additional IP address. However, the same Floating IP will have to be setup on all servers that you want to be able to route it to.

Note: Currently, Floating IPs does not work on VPS or Cloud servers.

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

Request Body schema: application/json
floatingIp
required
string

The Floating IP address

anchorIp
required
string

The Anchor IP address

passiveAnchorIp
string

The Passive anchor IP address used for Anchor IP toggling

Responses

Request samples

Content type
application/json
{
  • "floatingIp": "88.17.0.5/32",
  • "anchorIp": "95.10.126.1",
  • "passiveAnchorIp": "95.10.126.2"
}

Response samples

Content type
application/json
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "location": "AMS-01",
  • "type": "SITE",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "passiveAnchorIp": "95.10.126.2",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Inspect a range definition

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Responses

Request samples

curl --request GET \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions/%7BfloatingIpDefinitionId%7D \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "location": "AMS-01",
  • "type": "SITE",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "passiveAnchorIp": "95.10.126.2",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Update a range definition

Imagine you have 2 dedicated servers in AMS-01, in different racks. And you have a Floating IP definition for Floating IP 10.0.0.0_32. You have configured the ip address 10.0.0.0/32 on both dedicated servers.

If the anchor IP in the Floating IP definition is pointing to your first server, all traffic goes to that server. With this PUT request you can change the Anchor IP address to point to, for example, your second server. Within a matter of seconds all the traffic destined for the Floating IP will now end up at the new Anchor IP. In the above example, your second server.

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Request Body schema: application/json
anchorIp
required
string

The Anchor IP address

passiveAnchorIp
string

The Passive anchor IP address used for Anchor IP toggling

Responses

Request samples

Content type
application/json
{
  • "anchorIp": "95.10.126.1"
}

Response samples

Content type
application/json
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "location": "AMS-01",
  • "type": "SITE",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "passiveAnchorIp": "95.10.126.2",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Remove a range definition

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Responses

Request samples

curl --request DELETE \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions/%7BfloatingIpDefinitionId%7D \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "location": "AMS-01",
  • "type": "SITE",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.1",
  • "passiveAnchorIp": "95.10.126.2",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}

Toggle the anchor IP with the passive anchor IP

Imagine you have 2 dedicated servers in AMS-01, in different racks. And you have a Floating IP definition for Floating IP 10.0.0.0_32. You have configured the ip address 10.0.0.0/32 on both dedicated servers.

If the Anchor IP in the Floating IP definition is pointing to your first server, all traffic goes to that server. With this PUT request you can toggle the Anchor IP address to point to, for example, your second server, or any other server registered as the Passive Anchor IP. Within a matter of seconds the Anchor IP and the Passive Anchor IP will switch places and all the traffic destined for the Floating IP will now end up at the new Anchor IP. In the above example, your second server.

Authorizations:
X-LSW-Auth
path Parameters
rangeId
required
string
Example: 10.0.0.0_29

ID of a Floating IP Range, consisting of network IP and prefix length (separated by an underscore)

floatingIpDefinitionId
required
string

ID of a Floating IP Definition, consisting of network IP and prefix length (separated by an underscore)

Responses

Request samples

curl --request POST \
  --url https://api.leaseweb.com/floatingIps/v2/ranges/10.0.0.0_29/floatingIpDefinitions/%7BfloatingIpDefinitionId%7D/toggleAnchorIp \
  --header 'X-LSW-Auth: REPLACE_KEY_VALUE'

Response samples

Content type
application/json
{
  • "id": "88.17.34.108_32",
  • "rangeId": "88.17.0.0_17",
  • "location": "AMS-01",
  • "type": "SITE",
  • "customerId": "10001234",
  • "salesOrgId": "2000",
  • "floatingIp": "88.17.34.108/32",
  • "anchorIp": "95.10.126.2",
  • "passiveAnchorIp": "95.10.126.1",
  • "status": "ACTIVE",
  • "createdAt": "2019-03-13T09:10:02+0000",
  • "updatedAt": "2019-03-13T09:10:02+0000"
}