Skip to content
Luรญs Duarte edited this page Jan 10, 2024 · 4 revisions

Network Architecture

VRRP - Virtual Router Redundancy Protocol

VRRP is a protocol that automatically assigns available IP addresses (one or multiple IP addresses) to the participating hosts. It's an election protocol that dynamically assigns the main router to take all the traffic/routes (which means that by default, there's no link aggregation configured eg.: having two hosts with a throughput of 1Gbit using VRRP you will still have 1GBit of throughput).

This setup allows us to remove the single point of failure on a network, typically the router. In this case, the virtual router has an IP address of 10.10.0.254 (but each router has its IP too).

Each VRRP router has a priority associated with it and can be configured statically but can be changed dynamically by tracking processes, files, interfaces, or even external scripts that have a weight associated with and alter the router's VRRP priority. For example, if the router tracks the httpd process and httpd crashes the VRRP priority will be recalculated and can lead to the election of a new leader (or MASTER).

A VRRP router has one of three states:

  • MASTER - means that the router is currently the elected leader and it's serving all the routes.
  • BACKUP - means that the current router has a lower priority than another router and it's ready to take over the traffic if the elected leader fails.
  • FAULT - means that the current router is active but has an error and therefore cannot be elected as a leader if needed (eg.: if there is no internet connectivity).

To configure the FAULT in keepalived, you need to use an external script and if it exits with an exit code of 1 the router will enter into the FAULT state. This external script can be run periodically by keepalived.

You can read the RFC further to get an in-depth feel about VRRP: RFC2338