The following figure shows a typical VRRP configuration.
Figure 2 Layer 2 VRRP Router
In this example, the IP address 203.0.113.8 is configured as the default gateway for host1. This IP address is the virtual IP address that is protected by the virtual router that consists of two VRRP routers: router1 and router2. At any given time, only one of the two routers serves as the master router, assuming the responsibilities of the virtual router and forwarding packets that come from host1.
Assume that the VRID of the virtual router is 12. The following examples show the commands that are used to configure the example VRRP configuration on router1 and router2. router1 is the owner of the virtual IP address 203.0.113.8 and its priority is the default value (255). router2 is the standby router whose priority is 100.
Install VRRP package.
# pkg install vrrp
Create the VNIC vnic0 over net0 with the VRID value as 12.
# dladm create-vnic -m vrrp -V 12 -A inet -l net0 vnic0
Create a VRRP router vrrp1 over net0.
# vrrpadm create-router -V 12 -A inet -I net0 vrrp1
Configure IP interfaces vnic0 and net0.
# ipadm create-ip vnic0
# ipadm create-addr -T vrrp -a 203.0.113.8/24 vnic0/router1
# ipadm create-ip net0
# ipadm create-addr -a 203.0.113.100/24 net0/router1
Display the router information for vrrp1.
# vrrpadm show-router -x vrrp1 NAME STATE PRV_STAT STAT_LAST VNIC PRIMARY_IP VIRTUAL_IPS vrrp1 MASTER INIT 14.444s vnic0 203.0.113.100 203.0.113.8
Similarly, for router2:
Create the VNIC vnic1 over net1 with the VRID value as 12.
# dladm create-vnic -m vrrp -V 12 -A inet -l net1 vnic1
Create a VRRP router vrrp2 over net1.
# vrrpadm create-router -V 12 -A inet -I net1 -p 100 vrrp2
Configure IP interfaces on vnic1 and net1.
# ipadm create-ip vnic1
# ipadm create-addr -T vrrp -a 203.0.113.8/24 vnic1/router2
# ipadm create-ip net1
# ipadm create-addr -a 203.0.113.101/24 net1/router2
Display the router information for vrrp2.
# vrrpadm show-router -x vrrp2 NAME STATE PRV_STAT STAT_LAST VNIC PRIMARY_IP VIRTUAL_IPS vrrp2 BACKUP INIT 2m32s vnic1 203.0.113.101 203.0.113.8
By using the configuration of router1 as an example, you must configure at least one IP address over net0. This IP address of router1 is the primary IP address, which is used to send the VRRP advertisement packets.
# vrrpadm show-router -x vrrp1 NAME STATE PRV_STAT STAT_LAST VNIC PRIMARY_IP VIRTUAL_IPS vrrp1 MASTER INIT 14.444s vnic1 203.0.113.100 203.0.113.8