What Is a Floating IP?
A floating IP is a static public IP address that can be instantly reassigned between servers. Use it to:
- Perform zero-downtime server migrations
- Implement manual failover between primary and standby servers
- Maintain a stable IP while replacing the underlying server
Reserving a Floating IP
- Go to Network → Floating IPs → Reserve IP.
- Choose a region.
- The IP is reserved immediately.
Cost: $0.005/hr (~$3.60/month) while reserved but unattached.
Attaching to a Server
- Go to Network → Floating IPs → [Your IP] → Attach.
- Select the target server.
- The IP is routed to the server within seconds.
Configuring the OS
The floating IP must be configured on the server's loopback interface:
>_BASH
$# Ubuntu 22.04$ip addr add <FLOATING_IP>/32 dev loMake persistent:
>_BASH
$cat >> /etc/netplan/99-floating.yaml << EOF$network:$ version: 2$ ethernets:$ lo:$ addresses:$ - <FLOATING_IP>/32$EOF$netplan applyFailover Script Example
>_BASH
$#!/bin/bash$# Run on the standby server to claim the floating IP$$FLOATING_IP="203.0.113.100"$SERVER_ID="your-standby-server-id"$API_KEY="your-api-key"$$curl -X POST "https://api.lightyear.host/v1/floating-ips/$FLOATING_IP/attach" -H "Authorization: Bearer $API_KEY" -d "server_id=$SERVER_ID"