The commands
VRRP looks very like HSRP, with vrrp instead of standby. The group number comes first and is required:
| Command | Does |
|---|---|
vrrp 1 ip 192.168.10.1 | Join group 1 with this virtual IP |
vrrp 1 priority 110 | Higher wins (default 100) |
no vrrp 1 preempt | Pre-emption is on by default; this turns it off |
track 1 interface g0/1 line-protocol | A global track object for the uplink |
vrrp 1 track 1 decrement 20 | Lower the priority by 20 while object 1 is down |
In NetLab
▶ R1 R1>enable R1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R1(config)#track 1 interface g0/1 line-protocol R1(config)#interface g0/0 R1(config-if)#vrrp 1 ip 192.168.10.1 *Mar 1 00:00:05.000: %VRRP-6-STATECHANGE: Gi0/0 Grp 1 state Init -> Backup *Mar 1 00:00:05.000: %VRRP-6-STATECHANGE: Gi0/0 Grp 1 state Backup -> Master R1(config-if)#vrrp 1 priority 110 R1(config-if)#vrrp 1 track 1 decrement 20 R1(config-if)#end *Mar 1 00:00:08.000: %SYS-5-CONFIG_I: Configured from console by console ▶ R2 R2>enable R2#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R2(config)#interface g0/0 R2(config-if)#vrrp 1 ip 192.168.10.1 *Mar 1 00:00:12.000: %VRRP-6-STATECHANGE: Gi0/0 Grp 1 state Init -> Backup R2(config-if)#end *Mar 1 00:00:13.000: %SYS-5-CONFIG_I: Configured from console by console R2#show vrrp brief Interface Grp Pri Time Own Pre State Master addr Group addr Gi0/0 1 100 3609 Y Backup 192.168.10.2 192.168.10.1 ▶ PC2 student@PC2:~$ ping -c 3 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=3 ttl=254 time=0.580 ms --- 8.8.8.8 ping statistics --- 3 packets transmitted, 1 received, 67% packet loss, time 2002ms rtt min/avg/max/mdev = 0.580/0.580/0.580/0.000 ms
Tip: If the virtual IP is a router's own interface address, that router is the owner: its priority is 255 and it's always Master while it's up.
Tip: Newer IOS XE uses VRRPv3 with a slightly different syntax (
fhrp version vrrp v3, thenvrrp 1 address-family ipv4andaddress 192.168.10.1 primary). The ideas are the same.