Attach and detach a floating IP
Point a floating IP at an instance or a server, move it to another one, or take it off.
In the dashboard
Attach a floating IP to a Cloud Compute instance or a server on App Deployment to make it answer on the address. Detach it to take the address off again. The floating IP stays on your account either way, so you can attach it somewhere else later.
An IPv6 address attaches to Cloud Compute instances only. The IPv6 /64 that comes with an instance stays with it, as The IPv6 /64 of an instance explains.
Before you begin
Section titled Before you begin- The floating IP must be active, which the list shows with the badge Attached or Unattached. A suspended floating IP, which the list shows as Suspended, cannot be attached until you pay its invoice.
- You need an instance or a server on your account to attach it to. For an IPv6 address, you need an instance.
- An instance sets up its addresses when it starts, so plan to restart it after you attach or detach an address.
- A server holds one floating IP, and attaching or detaching can restart a running server.
Attach a single address
Section titled Attach a single addressIn the dashboard, go to Floating IPs, open the address and select the Attach tab. On the list, an unattached address has an Attach button on its card. An attached address has Move to another server in its ... menu, which opens the same Attach tab.
Under Choose a target, select an instance or a server. (On an address that is attached already, the card is titled Move to another target, its choices are off and it says
Detach the address above first.See Move a floating IP to another target.) Each one shows its name, status and type, and saysalready has a floating IPwhen it holds one. With more than six targets, a search box lets you find one by name. For an IPv6 address, the list holds instances only, and the card saysIPv6 addresses attach to Cloud Compute instances for now.For an IPv4 address on an instance, choose the address's role:
- Tick Make it the primary address to make it the instance's main address. The current primary address becomes an additional one.
- Leave it unticked to add the address next to the current one.
An instance with no address takes the first one you attach as its primary address, ticked or not. An IPv6 address has no role to choose: it is always an additional address, and the form says so in place of the box.
If you hold a coritan.gg name, you can tick Also give the address a name and type a name under it, such as
vm.survival-smp.coritan.gg. We create anArecord for the name in that zone once the address is attached, or anAAAArecord for an IPv6 address.Select Attach address.
The message that confirms the attach also says what to do next.
On an instance, restart the instance from its header. The instance sets up the address when it starts, as Start, stop and restart an instance explains, and a reboot typed inside the instance does not. An additional address gets a network interface of its own inside the instance, with no gateway. The instance sets up an IPv6 address with the prefix length /128.
On a server, the ports the server publishes move onto the address, and join addresses that point at the server follow it. For a Minecraft server, we also open the game's default ports on the address, 25565 for Java and 19132 for Bedrock, and make the matching one the server's main port, so players can connect with the address alone. A running server restarts only when the ports it uses change. The message says which applies:
We restart the server to bind the new address, which disconnects everyone playing.The address answers right away, with no restart.
When neither applies, such as for a server that is stopped, the page shows no message, and the address applies when the server next starts.
Note
A single IPv4 address costs nothing while it is an instance's primary address, and bills at its plan's price anywhere else. An IPv6 address bills at its plan's price wherever it is. Choosing the primary address therefore also chooses which address you pay for, as What a floating IP costs explains. An address your account plan pays for costs nothing wherever it is. When it becomes an instance's primary address, the plan stops counting it. The plan then pays for your oldest other address that costs money, if you have one, from that address's next renewal (When your account plan pays for it).
Attach a host of a subnet
Section titled Attach a host of a subnetEach host of a subnet attaches to one instance or server. You can attach the other hosts of the same subnet to other targets, one at a time.
- Open the subnet and select the Attach tab. You can also open the Hosts tab, open a free host's actions menu and select Attach, which opens the tab with that host chosen.
- Under Choose a target, select the instance or server.
- Under Host address, choose a host, or leave First free host to take the lowest free one. The hint under the field says how many hosts are free.
- Select the button under the form. It reads Attach address, or
Attachfollowed by the host when you chose one.
Then restart the instance, or check the message for a server, as for a single address.
Move a floating IP to another target
Section titled Move a floating IP to another targetA single address attaches to one target at a time, so you move it by detaching it and attaching it again. While the address is attached, the targets under Move to another target are off and the button reads Attach address with Detach it first beside it.
- On the Attach tab, select Detach… on the Currently attached card, then select Detach address. On the list, Move to another server in the card's ... menu opens this tab.
- Under Choose a target, select the new instance or server, and select Attach address.
- Restart the instance you attached the address to. Also restart the instance you took it from, so that it stops using the address.
The address keeps its reverse DNS and its DDoS Shield settings when it moves.
Detach a floating IP
Section titled Detach a floating IP- Select Detach… on the floating IP's card in the Floating IPs list, or open the floating IP and select Detach… in the header. On the Attach tab, the button is on the Currently attached card.
- Read what the dialog says will stop working, then select Detach address.
A subnet has no Detach… on its card, because each host detaches on its own.
To detach one host of a subnet, open the Hosts tab, open the host's actions menu and select Detach….
On an instance, we take the address out of the instance's network settings. Restart the instance to apply the change. When the address was the primary one, the address that has been attached to the instance longest becomes the primary address. An instance with no address left has no public IPv4 address until you attach one.
On a server, the ports the server published on the address go back to the address it used before, and the ports we opened on the floating IP close. Players then connect with that address and its port again. A running server restarts when the ports it uses change, and the message after detaching says so.
The floating IP stays on your account, and we keep billing it until you cancel it.
The IPv6 /64 of an instance
Section titled The IPv6 /64 of an instanceThe IPv6 /64 that comes with a Cloud Compute instance is attached to that instance from the start, and stays with it until the instance ends. You cannot detach it or move it. Its panel has no Attach tab and no Detach… button, and a link to its Attach tab opens its Overview tab. Add IPv6 to an instance explains how an instance gets its /64.
For an IPv6 address that you can move between instances, order an IPv6 address and attach it as Attach a single address describes.
Result
Section titled ResultThe Currently attached card on the Attach tab shows the Target, its Type and Since when. On an instance, Role shows Primary address or Additional address. On a server, Delivery shows whether the address has reached the server's host. The Floating IPs list shows the floating IP with the badge Attached and the target under Attached to, and the address appears on the instance's Network tab.
After a detach, the list shows Unattached and a message such as 203.0.113.10/32 detached., and the Overview tab shows Not attached to anything yet.
Troubleshooting
Section titled TroubleshootingDetach it firstunder Attach address- The address is attached to another target. Detach it, then attach it to the new one, as Move a floating IP to another target describes.
- A message that starts
IP is already attached to - The address is attached elsewhere. The message names the service it is attached to. Detach it there first.
Container already has a primary floating IP; detach first- The server already has a floating IP. Detach that one first, or choose another server.
Unsuspend the IP service before attaching- The floating IP is suspended, usually for an unpaid invoice, and a suspension also detaches it. Pay the open invoice, then attach it again.
IP service must be active or suspended to attach- The floating IP is not ready yet. Wait until the badge in the list stops saying Pending.
No free host in this block- Every usable host of the subnet is attached. Detach a host on the Hosts tab, or order another subnet.
Address is reserved (network/broadcast/gateway) and cannot be attached- You chose the network, gateway or broadcast address of a subnet. Choose a usable host instead. How subnets work explains which addresses those are.
Nothing to attach to- You have no instance or server on your account, or, for an IPv6 address, no instance. Select Order service to order one.
- A message that starts
This server's node - The server's host cannot take a floating IP yet, and nothing was attached. Contact support with the server's name.
- A message that starts
Failed to program guest IPorCould not place the floating IP on the server's host - We could not set up the address on the target, and nothing was attached. Try again. If the message stays, contact support.
IP was attached by a concurrent request; refresh and try again- Another tab attached the address at the same moment. Reload the page to see where it went.
- The address does not answer on an instance
- Restart the instance from its header. Addresses are set up when the instance starts from the dashboard, and a
reboottyped inside the instance does not set them up. - Last error on the Currently attached card
- The address has not reached the server's host. Detach it and attach it again. If the error comes back, contact support.
Related
Section titled Related- Manage an instance's addresses and names
- Set reverse DNS for a floating IP
- How subnets work
- Cancel a floating IP
- How join addresses work
With the API
Section titled With the APIGET /api/v1/client/ips/attach-targets lists the instances and servers on your account that you can attach a floating IP to.
curl https://api.coritan.com/api/v1/client/ips/attach-targets \
-H "Authorization: Bearer $CORITAN_TOKEN"
{
"items": [
{"service_id": 118, "hostname": "vm.example.com", "module_name": "vps", "resource_id": 57, "resource_status": "running", "has_floating_ip": true},
{"service_id": 131, "hostname": "survival-smp", "module_name": "container", "resource_id": null, "resource_status": "active", "has_floating_ip": false}
],
"total": 2
}
module_name is vps for an instance and container for a server. has_floating_ip is true when the target already has a floating IP attached. The list holds both kinds for every floating IP, and an IPv6 address attaches only to a target whose module_name is vps.
POST /api/v1/client/ips/{service_id}/attach attaches the floating IP whose service ID is in the path:
curl -X POST https://api.coritan.com/api/v1/client/ips/214/attach \
-H "Authorization: Bearer $CORITAN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"target_type": "vps", "target_service_id": 118, "is_primary": false}'
| Field | Meaning |
|---|---|
target_type |
Required. vps for an instance, container for a server. |
target_service_id |
Required. The target's service_id from the list above. |
is_primary |
Instances and IPv4 only. true makes the address primary and false adds it next to the current one. Left out, the address becomes primary only when the instance has no address yet. An IPv6 address is never primary, so leave it out. |
host_address |
Subnets only. The host to attach. Leave it out to attach the lowest free host. |
host_inventory_id |
Subnets only. The host's id from the subnet's host list, in place of host_address. |
The response is the new attachment: its address, target_type, target_service_id, is_primary and attached_at. Attaching an address to the target it is already on returns the existing attachment. For a server, the response also carries publish:
requires_restartistruewhen the server restarts to use the address.reachable_nowistruewhen the address answers without a restart.restartisnot_needed,scheduledorpending.
POST /api/v1/client/ips/{service_id}/detach detaches the floating IP. The body is optional. For a subnet with more than one host attached, send the host_address or host_inventory_id of the host to detach:
curl -X POST https://api.coritan.com/api/v1/client/ips/220/detach \
-H "Authorization: Bearer $CORITAN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"host_address": "203.0.113.18"}'
The response has detached set to true and the removed attachment under previous, plus publish for a server. A floating IP that is not attached answers the same way with already_detached set to true and previous set to null.
| Response | When |
|---|---|
404 |
The floating IP, or the target service, does not exist. |
403 with You do not own this service |
The floating IP, or the target service, is on another account. |
409 with a message that starts IP is already attached to |
The address is attached to another target. |
409 with Container already has a primary floating IP; detach first |
The server already has a floating IP. |
409 with Unsuspend the IP service before attaching |
The floating IP is suspended. |
409 with No free hosts available in this subnet |
Every usable host of the subnet is attached. |
409 with This server takes IPv4 floating IPs only for now. Attach this IPv6 address to a Cloud Compute instance. |
You attached an IPv6 address to a server. |
409 with This /64 comes with its instance and stays with it. |
You tried to attach or detach an instance's IPv6 /64. |
422 with An IPv6 address is never an instance's primary address. Leave is_primary out. |
You sent is_primary as true for an IPv6 address. |
422 with target_service_id must be a Cloud Compute service or target_service_id must be a container service |
target_type does not match the service. |
422 with host_address / host_inventory_id only apply to subnet block services |
You sent a host for a single address. |
422 with Subnet has multiple attached hosts; pass host_address to detach one |
A detach of a subnet named no host. |
The Floating IPs API reference lists every field.
API operations on this page
| Method | Path | What it does |
|---|---|---|
GET | /api/v1/client/ips/attach-targets | Thin list of owned compute services eligible as floating-IP attach targets |
POST | /api/v1/client/ips/{service_id}/attach | Attach IP |
POST | /api/v1/client/ips/{service_id}/detach | Detach IP (or one subnet host) from its compute target; service remains on your account |