Skip to content
Contents
GuidesOpenWrt

Which connections survive an OpenWrt VRRP failover?

Two routers have separate management addresses at the data link layer for a shared client. They jointly provide a virtual gateway address.

Two routers have separate management addresses at the data link layer for a shared client. They jointly provide a virtual gateway address. Use Keepalived to define VRID, priority, and advertisement interval. VRRP transfers the gateway address. Existing NAT, VPN, and stateful inspection are separately validated based on business requirements.

Complete fault-free communication first

The first unit is primary, the second is backup, and VRRP advertisements are allowed within this subnet. A virtual address is pushed to clients as the gateway. DHCP must still explicitly designate which server provides it. Verify that the virtual address appears only on the host, and confirm the default path via a regular new connection.

When do the IP address and services recover during VRRP failover?

A client continuously sends new HTTP requests while maintaining an established TCP connection. In the experiment window, terminate the current VIP holder, read the standby machine's address, observe neighbor changes, and record the request recovery time.

Shutdown the primary router, disconnect the primary router's WAN, and then restore the primary router. Test each step. Monitor WAN conditions with configuration tracking, recording the last successful, first re-established, and original TCP flow behavior. Recovery time at millisecond or second level is based on actual probe precision, announcements, and device connectivity.

After the virtual IP moves, check which sessions have to reconnect. Repeat when the original primary returns, and check for simultaneous primaries or traffic returning through the wrong router.

Lab record

I used two OpenWrt 25.12.6 x86/64 VMs. Their br-lan addresses were 192.168.21.1 and 192.168.21.2. The client used 192.168.21.254 as its gateway. Keepalived sent unicast VRRPv3 adverts every second, using priorities of 150 and 100. The routers did not share NAT connection state.

I cut the primary LAN at the virtual switch three times and started a fresh HTTP request about every 200 ms. The first successful request via the backup was started about 3.2–3.8 s after the cut. The primary carried requests again 0.2–1.2 s after reconnecting. In an earlier run without periodic gratuitous ARP, requests still used the backup 7 s after reconnecting. The final runs used the 2 s refresh below. One run briefly returned to the backup. New requests stayed on the primary from about 0.2–2.4 s after reconnection through the end of the observation.

The TCP stream opened before the cut received no echo while the backup handled new requests. Use the same VRID and virtual address at both ends. On the backup change the source address, peer address and priority. Check the VIP, the client's ARP entry and application traffic. Add separate WAN tracking if WAN loss should trigger takeover.

vrrp_instance LAB_GATEWAY {
  state BACKUP
  interface br-lan
  version 3
  virtual_router_id 51
  priority 150
  advert_int 1
  garp_master_refresh 2
  unicast_src_ip 192.168.21.1
  unicast_peer {
    192.168.21.2
  }
  virtual_ipaddress {
    192.168.21.254/24 dev br-lan
  }
}

Three primary LAN link cuts. Each dot is a new HTTP request, coloured by the router's WAN address seen by the test server.

Three primary LAN link cuts. Each dot is a new HTTP request, coloured by the router's WAN address seen by the test server.

Disconnect the active LAN link, check the VIP on the backup and repeat the request. · OpenWrt 25.12.6 x86/64 (QEMU/KVM).
Check the terminal output
Disconnect the active LAN link, check the VIP on the backup and repeat the request. · OpenWrt 25.12.6 x86/64 (QEMU/KVM).
Disconnect the active LAN link, check the VIP on the backup and repeat the request. · OpenWrt 25.12.6 x86/64 (QEMU/KVM). Open the original image

Reference

Related guides

Reference

Check the model, region and hardware revision on the label before selecting firmware.

Explore hardware

Comments