> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/2.9/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/fpp/2.9/vrrp.md).

# FPP VRRP enablement

>**FEATURE STATE:** beta

VPP supports VRRP v3 RFC 5798. Using the `afterCommand` spec section of the `VPPConfig` object, it's possible to enable redundancy between VRRP peers.

To provide router redundancy, configure each VPP to be in the same virtual router (VR) group with the same ID. To avoid multicast flood within the network and the number of VRs is known, VRRP can be configured in the `unicast` mode. This documentation describes how to achieve this.

To allow the backup device to act as a full replicant for a master device, configure VRRP in the `accept` mode.

> **CAUTION:**
>
> VRRP is a beta feature exposed as VPP CLI command configuration. In future FPP releases, it will be managed through a Custom Resource configuration.

## Adjusting interface with virtual router address

Router redundancy expects the Virtual Router Address (Virtual IP) to be assigned to the interface that exposes it on the VRRP master node.
The VRRP manages the IP address assignment in the VRRP group defined by a Virtual Router ID `vr_id`.

To exclude that Virtual IP from being managed by the FPP Operator, define the following configuration in VPPConfig on both master and backup nodes:

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPConfig
metadata:
  name: vpp-example-vrrp-master
  namespace: fpp-sample
  labels:
...
spec:
  manualConfig:
    ips:
    - 10.10.0.15/24
```

## VRRP configuration on the interface

The VR configuration should include a dedicated interface in the particular VR group. Configure the group identifier (VR ID) on each VRRP peer. In the VPP configuration, VR ID is configured per interface:

```bash
vrrp vr add <interface> vr_id <id> priority <X> accept_mode <VR Address> [unicast]
```

VRRP can use either a `unicast` or a `multicast` mode. By default, `multicast` VRRP advertising is used. This mode is recommended for generic deployments.

Example: VR ID `1` with priority `250` and VR Address `10.10.0.15` on the interface `memif0/100`:

```bash
vrrp vr add memif0/100 vr_id 1 priority 250 accept_mode 10.10.0.15
```

To enable VRRP in the `unicast` mode, an additional configuration parameter must be added:

```bash
vrrp vr add memif0/100 vr_id 1 priority 250 accept_mode 10.10.0.15 unicast
```

For `unicast`, VRRP IP address of peer is required:

```bash
vrrp peers <interface> vr_id <id> <peer IP address>
```

Example:

```bash
vrrp peers memif0/100 vr_id 1 10.10.0.2
```

To start the VRRP protocol with configured VR Group on the given interface, add the following CLI:

```bash
vrrp proto start <interface> vr_id <id>
```

Example:

```bash
vrrp proto start memif0/100 vr_id 1
```

## VPPConfig configuration

The following example provides an `afterCommands` list of CLI calls to perform setup on VRRP master and backup.
The Virtual Router ID defines that VRRP Group should be the same for every VR.

### VRRP Master

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPConfig
metadata:
  name: vpp-example-vrrp-master
  namespace: fpp-sample
  labels:
...
spec:
  afterCommands:
    # 10.10.0.15/24 is a virtual IP managed by VRRP, no need to define it by CLI
    - vrrp vr add {{ .Ifs.master.Name }} vr_id 1 priority 250 accept_mode 10.10.0.15 # multicast mode.
    - vrrp proto start {{ .Ifs.master.Name }} vr_id 1
  manualConfig:
    # Define Virtual IP as IP managed external to FPP Operator.
    ips:
    - 10.10.0.15/24
  interfaces:
  - master
...

```

### VRRP Backup

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPConfig
metadata:
  name: vpp-example-vrrp-backup
  namespace: fpp-sample
  labels:
...
spec:
  afterCommands:
    - vrrp vr add {{ .Ifs.backup.Name }} vr_id 1 priority 100 accept_mode 10.10.0.15 # 10.10.0.15 is virtual IP
    - vrrp proto start {{ .Ifs.backup.Name }} vr_id 1
  manualConfig:
    # Define Virtual IP on backup instance, to prevent it being deleted by FPP Operator in the reconcile loop
    ips:
    - 10.10.0.15/24
  interfaces:
  - backup
...

```
