keepcalculator

06 Numbers and Powers

VIP Virtual IP Address: Definition, Failover & How It Works

Card No. 06·48733 · Updated · Standard formula, shown below

A Virtual IP address (VIP) is a floating IP address shared by a group of servers, so clients always talk to one stable address while the actual server behind it can change. You enter the VIP as your destination, and the system routes your traffic to whichever member is currently active. This is the core trick behind high-availability clusters, load balancers, and database failover.

What Is a Virtual IP Address?

A virtual IP address is an IP address that is not tied to a single physical network interface. Instead, it is assigned to a logical group — usually a cluster of two or more servers. The VIP is advertised to clients, DNS, or upstream routers, and the group decides which member currently “owns” the VIP and responds to traffic.

The key property is floating: when the active node fails or is taken down for maintenance, the VIP is reassigned to another node in the group. Clients keep using the same IP, so they never see the switch. This is what makes services like database clusters, web server pools, and firewalls highly available without requiring clients to change configuration.

How a Virtual IP Works

At the network layer, a VIP is just a normal IP address. The magic happens in how the cluster manages it:

  1. Active node holds the VIP — the current primary server binds the VIP to one of its interfaces and answers ARP requests for it.
  2. Standby node monitors — the backup server sends periodic health checks (heartbeats) to the active node over a dedicated link or the network.
  3. Failure detected — if the standby stops receiving heartbeats, it declares the active node dead and takes over the VIP.
  4. ARP update — the new active node sends a gratuitous ARP reply, telling switches and routers that the VIP’s MAC address has changed. From then on, traffic to the VIP goes to the new server.

This process is usually handled by software like Keepalived (VRRP), Pacemaker/Corosync, or cloud-native load balancers. In cloud environments, the VIP may be implemented as a floating IP that the cloud API reassigns to a different VM or instance.

Failover and High Availability

Failover is the entire reason VIPs exist. Without a VIP, if a server dies, clients would need to switch to a different IP — which means DNS updates, cached addresses, and broken connections. With a VIP, the switch is transparent.

There are two common failover modes:

  • Active/Passive — one node handles all traffic, the other sits idle. The standby takes over only when the active fails. Simple and predictable, but the standby is wasted capacity.
  • Active/Active — both nodes handle traffic, each with its own VIP (or a shared VIP with load balancing). If one fails, the other absorbs its load. More efficient but requires the application to support multi-node operation.

Failover time depends on the heartbeat interval and detection method. A typical VRRP setup fails over in 1–3 seconds. Some systems use link-state tracking or application-level health checks, which can take longer but catch more failure types (e.g., a hung process, not just a dead NIC).

VIP vs. Load Balancer IP

People often confuse a VIP with a load balancer’s IP. They are related but not identical:

  • A load balancer accepts traffic on a VIP and distributes it across multiple backend servers. The VIP is the front-end address.
  • A failover VIP is simply a floating address that moves between nodes; it does not necessarily distribute traffic. It just ensures one node is always reachable.

In practice, many load balancers (like HAProxy or NGINX) run in an active/passive pair with a VIP. The VIP is the entry point, and the load balancer itself does the distribution. So the VIP is the “front door,” and the load balancer is the “doorman.”

Common Problems and Misconceptions

Even though VIPs are simple in theory, real deployments hit several recurring issues:

  • ARP cache timeouts — some switches and hosts cache the old MAC address after a failover, so traffic keeps going to the dead node. Gratuitous ARP usually fixes this, but some network gear needs a few seconds to update.
  • Split-brain — if the heartbeat link fails but both nodes stay up, both may try to own the VIP. This causes IP conflicts and intermittent outages. Solutions include using a tie-breaker (like a quorum disk) or a separate management network.
  • VIP not reachable from outside — the VIP must be routable. If it is on a subnet that the router doesn’t know, or if firewalls block the protocol (like VRRP on UDP port 112), failover won’t work.
  • Misconception: VIP means the IP is “virtual” in the sense of not being real. It is a real, routable IP — it just isn’t permanently bound to one NIC.

How to Choose a VIP Setup

Choosing the right VIP approach depends on your environment and requirements:

  1. On-premises Linux servers — use Keepalived with VRRP. It is free, well-documented, and works with any application that can bind to an IP.
  2. Windows Server — use Windows Server Failover Clustering (WSFC) with a cluster IP. It integrates with SQL Server and other Microsoft services.
  3. Cloud (AWS, Azure, GCP) — use the cloud’s floating IP feature (e.g., AWS Elastic IP, Azure Floating IP). The cloud control plane handles the reassignment, so you don’t need VRRP.
  4. Kubernetes — use a Service of type LoadBalancer, which creates a VIP managed by the cloud provider or MetalLB for bare metal.

Key factors: failover time you need, whether the application supports active/active, and whether you want to manage the protocol yourself or let the cloud do it.

Safety and Best Practices

VIPs are safe when configured correctly, but a few rules prevent outages:

  • Always have a heartbeat on a separate network — if the heartbeat shares the data network and that network goes down, you get split-brain.
  • Test failover regularly — a failover that has never been tested will fail when you need it. Kill the active node during a maintenance window and watch the standby take over.
  • Monitor the VIP from outside — internal health checks may miss issues that external clients see. Use a synthetic monitor that connects through the VIP.
  • Document the failover procedure — when something breaks, you don’t want to be reading man pages.

Frequently Asked Questions

What is the difference between a virtual IP and a public IP?

A public IP is assigned to a specific device and is routable on the internet. A virtual IP is a logical address that can be moved between devices. A VIP can be public or private depending on your network design. The key is that the VIP is not permanently attached to one NIC.

Can a virtual IP work without a load balancer?

Yes. A VIP is just a floating address. You can have two servers with a VIP and no load balancing at all — the active server handles all traffic, and the standby only takes over on failure. Load balancing is a separate function that often uses a VIP as its front end, but they are independent concepts.

How long does a typical failover take?

With VRRP and a 1-second heartbeat, failover usually completes in 1–3 seconds. Cloud floating IPs can take 10–30 seconds because the control plane has to detect the failure and reassign the IP. Application-level health checks (e.g., checking if a database is responding) can take longer — sometimes 30 seconds or more — depending on the check interval and timeout.

What happens to active connections during a failover?

Existing TCP connections are usually dropped because the new server does not have the connection state. The client will see a timeout or connection reset and must reconnect. This is why failover is not zero-downtime — it is designed to minimize downtime, not eliminate it. For truly seamless failover, you need session replication or a load balancer that maintains connection state.

Is a VIP the same as a floating IP in cloud computing?

Yes, in most cloud platforms, a floating IP is exactly a virtual IP. The cloud provider lets you assign a public IP to one instance, and when that instance fails, you can reassign the IP to another instance. The difference is that the cloud does the ARP and routing magic for you — you just call an API.

Can two servers use the same VIP at the same time?

Only if they are configured for active/active with a load balancer that splits traffic. In a simple active/passive setup, only one server should own the VIP at a time. If both try to own it, you get an IP conflict and intermittent connectivity — this is the split-brain problem.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →