Fail Fast Within One Datacenter Using DigitalOcean Floating IPs
Move a static public IP between Droplets in seconds without DNS changes, but know what failover does and doesn't protect.
07 Nov 2025, 17:55 UTC

The problem: users keep hitting a dead server
Your primary Droplet loses network connectivity or its web process stops. DNS still points to the server's IP, and because DNS records cache for minutes or hours, visitors keep trying the broken address. You need traffic to move to a standby Droplet in the same datacenter without waiting for DNS propagation.
What a Floating IP does
A Floating IP is a static public IP address that you can reassign between Droplets in the same datacenter. It attaches to a Droplet's public network interface, and DigitalOcean routes traffic for that address to whichever Droplet currently holds it. Reassignment happens through the control panel, API, or doctl, and it is much faster than changing DNS.
This is not a load balancer. It does not terminate TLS, spread traffic across many nodes, or check application health on its own. It also does not copy files, database rows, or user sessions between servers. Failover moves the network endpoint only.
Worked example: reassign an IP with doctl
Run these commands from a local workstation or management host where doctl is installed and authenticated with a DigitalOcean API token that has read and write access to floating IPs and Droplets.
# Reserve a new Floating IP in the same datacenter as your Droplets
doctl compute floating-ip create --region nyc3
# Assign it to Droplet A. Replace placeholders with your own values.
doctl compute floating-ip assign FLOATING_IP DROPLET_ID_A
# Confirm the IP currently serves Droplet A
curl -I http://FLOATING_IP/
Expected check: the response headers should come from Droplet A's web server. If you get a timeout, verify the Droplet's firewall allows HTTP on the public interface and that the Floating IP is active in the control panel.
To fail over to Droplet B, reassign the IP:
doctl compute floating-ip assign FLOATING_IP DROPLET_ID_B
Then repeat the curl check against FLOATING_IP. The response should now originate from Droplet B. Because the IP address itself does not change, clients do not need a new DNS lookup, but any active TCP connections to Droplet A will break and must be retried by the client.
If you automate this with keepalived or a custom health-check script, add a cooldown period and a manual override. Aggressive checks can cause IP thrashing, where the address flips back and forth between two Droplets that both appear unhealthy.
Limitations and what to verify
- Floating IPs cannot move between regions. Multi-region disaster recovery needs separate IPs and DNS-level steering.
- DigitalOcean bills for Floating IPs monthly whether or not they are assigned, and accounts have regional quotas. Confirm current pricing and limits before provisioning.
- Failover does not replicate application state. If Droplet A was handling a file upload or database transaction, that work is not transferred to Droplet B.
Practical check: schedule a maintenance window, stop the web service on Droplet A, trigger reassignment to Droplet B, and measure how long it takes for an HTTP request to succeed again. Test your client's retry behavior so you know what users experience during the gap.
Rollback
Reassignment changes state. To roll back, run the assign command again pointing the Floating IP at the original Droplet, then confirm traffic returns to it.
Bottom line
Use a Floating IP when you need a stable public endpoint that can move quickly between two Droplets in one datacenter. Pair it with a health-check script and client retries, but do not mistake it for automatic load balancing or shared application state.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.