Skip to content

Virtual IP Config

High Availability (HA) clusters often rely on virtual IP addresses (VIPs) to ensure services remain accessible even when individual nodes fail. A VIP acts as a shared, floating IP address that the cluster manages, allowing clients to connect to services without needing to know the underlying node's IP. This section explains how to configure and manage VIPs in a Pacemaker-based cluster.


Planning Your VIP Configuration

Before configuring a VIP, consider these factors:
- Subnet isolation: Assign the VIP to a dedicated subnet (e.g., 192.168.100.0/24) to avoid conflicts with node IPs.
- Network interface: Ensure all cluster nodes have a physical or virtual interface connected to the VIP subnet.
- Failover priority: Define which nodes should own the VIP during normal operation (e.g., using stonith or fence devices for failover).


Configuring the VIP on the Operating System

Each node must have the VIP assigned to its network interface. Use ip or nmcli to configure this. For example:

# Assign VIP to eth0 on node1
sudo ip addr add 192.168.100.10/24 dev eth0
sudo ip link set eth0 up
Verify the interface is active:
ip addr show eth0


Adding the VIP to Pacemaker

Use pcs to create a VIP resource. Replace 192.168.100.10 with your VIP and node1 with the primary node:

pcs resource create VIP IPaddr2 \
  ip=192.163.100.10 \
  cidr_netmask=24 \
  nic=eth0 \
  op monitor interval=30s
This creates a resource named VIP that manages the IP address. Ensure the resource is started:
pcs status


Managing VIP Failover

Pacemaker automatically moves the VIP to a healthy node during failover. To test:
1. Simulate node failure:

sudo systemctl stop corosync
2. Check VIP ownership:
ip addr show eth0 | grep "inet\|inet6"
The VIP should now be on the secondary node.


Troubleshooting Common Issues

  • VIP not assigned: Ensure the interface is up and the subnet is correctly configured.
  • Failover not working: Check stonith configuration and ensure nodes are reachable via fencing.
  • Conflicts with static routes: Use ip route to verify routing tables if the VIP is on a different subnet.

Key takeaways

  • VIPs provide a stable endpoint for HA services, abstracting node-specific IP addresses.
  • Configure VIPs on all cluster nodes and assign them to a dedicated subnet.
  • Use pcs to manage VIP resources, ensuring they are monitored and failover-ready.
  • Test failover scenarios to validate VIP migration and network resilience.
  • Always isolate VIP subnets to avoid conflicts and ensure predictable routing.