Mastering Hetzner Floating IPs: A Beginner’s Guide

Introduction

Floating IPs are a powerful tool in Hetzner’s cloud, allowing you to keep services online even when servers fail or need maintenance. In this guide we break down what a floating IP is, how it works in Hetzner, and step‑by‑step instructions to configure one for your projects.

What Is a Floating IP?

A floating IP is an address that can be moved between virtual machines (VMs) with just a few clicks or API calls. It acts as a stable entry point for traffic while the underlying server can change without affecting your users.

Key Benefits

  • High availability: Quickly shift traffic to a healthy server.
  • Zero‑downtime updates: Deploy a new version on a second VM, then swap the IP.
  • Simplified DNS management: No need to edit DNS records for each change.

How Hetzner Implements Floating IPs

Hetzner provides floating IPs as a separate resource in the Cloud Console. Under the hood they are a /32 address that is attached to a server’s public interface via a virtual router. When the IP is reassigned, Hetzner updates the routing table, and the change propagates within seconds.

Related Terms

  • Primary IP: The fixed address assigned when a server is created.
  • Failover IP: Hetzner’s terminology for a floating IP used for automatic failover.
  • Private Network: Optional internal network for server‑to‑server communication.

Step‑by‑Step Setup

1. Create a Floating IP

  1. Log in to the Hetzner Cloud Console.
  2. Navigate to Floating IPsAllocate Floating IP.
  3. Select the datacenter where your servers reside.
  4. Choose the type (IPv4 or IPv6) and click Allocate.

2. Attach the IP to a Server

  1. In the floating IP list, click Assign to Server.
  2. Select the target server and confirm.
  3. The console will display the new IP under the server’s Network tab.

3. Configure Your Server

Most Linux distributions detect the new address automatically. If not, add it manually:

# ip addr add 123.45.67.89/32 dev eth0 # ip route add default via 123.45.67.1 dev eth0

Replace 123.45.67.89 with your floating IP and eth0 with the appropriate interface.

4. Test Connectivity

From a remote machine, run:

ping 123.45.67.89

If you receive replies, the floating IP is active.

5. Switching the IP (Failover)

When you need to move the IP:

  1. Detach it from the current server (Console → Unassign).
  2. Assign it to the standby server.
  3. Verify the new server’s firewall allows traffic on required ports.

The switch usually takes less than 5 seconds.

Best Practices for Production Environments

  • Use health checks: Automate the failover with a monitoring tool (e.g., Hetzner’s built‑in health checks or third‑party services).
  • Keep a warm standby: Maintain a secondary server with the same software stack, ready to take over.
  • Sync data: Use rsync, DRBD, or a shared storage solution to keep files consistent.
  • Secure the IP: Restrict inbound traffic with firewalls (ufw, nftables, or Hetzner Cloud Firewall).

FAQ

Can I use a floating IP with Kubernetes?

Yes. Deploy a LoadBalancer service or use MetalLB in layer‑2 mode to hand out Hetzner floating IPs to your pods.

Is there an extra cost?

Hetzner charges a small monthly fee per floating IP (currently €1.19 for IPv4 and €0.79 for IPv6). The fee covers routing and management.

Do I need a public DNS record?

It’s recommended to point a DNS A/AAAA record to the floating IP. This way, DNS never changes even when you reassign the IP.

What happens during a server reboot?

The floating IP stays attached to the server, so services remain reachable after the OS comes back online.

Can I assign one floating IP to multiple servers simultaneously?

No. A floating IP can be bound to only one server at a time, ensuring a single point of entry.

Conclusion

Hetzner floating IPs simplify high‑availability setups, zero‑downtime deployments, and disaster recovery. By allocating an IP, attaching it to a server, and following the best‑practice checklist, you can keep your services online with minimal effort.

Ready to make your Hetzner infrastructure more resilient? Allocate a floating IP today and start building a fault‑tolerant architecture.

Call to Action

Need help configuring floating IPs or designing a failover strategy? Contact our cloud experts for a personalized walkthrough.

Comments are closed, but trackbacks and pingbacks are open.