This is the 16th day of my participation in Gwen Challenge

Concept of VRRP

VRRP protocol states are as follows: Initialize, Master, and Backup.

The Initialize state:

All VRRP routers start in the Initialize state when the port is DOWN (including manual shut or physical)

Return to Initialize state;

Backup status:

− Does not perform gateway duties;

− Does not respond to ARP requests whose destination IP address is Virtual IP.

− Discards the packets whose destination MAC address is Virtual.

− Discards the packets whose destination IP address is Virtual.

The Master state:

− Performs gateway functions

− Responds to ARP requests whose destination IP address is Virtual IP.

− Forwards packets whose destination MAC addresses are Virtual MAC addresses.

Examples of VRRP

In this experimental topology, VRRP routers are generally connected to switches. Because a port on a router is a broadcast domain, three routers need to be connected to the same broadcast domain through switches

PC1:

PC1(config)#int f0/0

PC1 (config – if) # IP add 172.16.1.3 255.255.255.0

PC1(config-if)#no sh

PC1(config)#no ip routing

PC1 (config) # IP default gateway – 172.16.1.254

R1:

R1(config)#track 1 interface G1/0 line-protocol -> Set the monitoring upstream port

R1(config)#int g0/0

R1 (config – if) # IP add 172.16.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)# VRRP 1 IP 172.16.1.254 -> Set the virtual IP address

R1(config-if)# VRRP 1 priority 120 -> Set the priority. The default is 100

R1(config-if)# VRRP 1 track 1 Decrement 30 -> Reduces priority values when an interface is disabled

R1(config-if)# VRRP 1 preempt delay minimum 5 -> Set the preemption delay to 5s

R1(config)#int g1/0

R1 (config – if) # IP add 10.1.123.1 255.255.255.0

R1(config-if)#no sh

R1 (config – if) # 2 IP 10.1.123.254 VRRP

R1(config-if)#vrrp 2 track 2 decrement 30

R1(config-if)#vrrp 2 preempt delay minimum 5

R2:

R2(config)#int g0/0

R2 (config – if) # IP add 172.16.1.2 255.255.255.0

R2(config-if)#no sh

R2 (config – if) # 1 IP 172.16.1.254 VRRP

R2(config-if)#vrrp 1 track 1 decrement 30

R2(config-if)#vrrp 1 preempt delay minimum 5

R2(config)#track 2 interface g1/0 line-protocol

R2(config-if)#int g1/0

R2 (config – if) # IP add 10.1.123.2 255.255.255.0

R2(config-if)#no sh

R2 (config – if) # 2 IP 10.1.123.254 VRRP

R2(config-if)#vrrp 2 priority 120

R2(config-if)#vrrp 2 track 2 decrement 30

R2(config-if)#vrrp 2 preempt delay minimum 5

R3:

R3(config)#int g0/0

R3 (config – if) # IP add 10.1.123.3 255.255.255.0

R3(config-if)#no sh

R3(config)#int loopback 0 -> Configure loopback test

R3 (config – if) # IP add 3.3.3.3 255.255.255.255

R3(config)# IP route 172.16.1.0 255.255.255.0 10.1.123.254 -> Return route

Here are some optional commands:

VRRP 1 preempt # Preempt support, default value

VRRP 1 Timers Advertise1 # Set the Advertisement time to 1 second. The default value is VRRP

VRRP 1 authentication MD5 key-string Cisco # Set the MD5 authentication password to Cisco

Once set successfully, you can see the log from R1

*Dec 12 11:30:32.631: % VRRP-6-statechange: gi0/0 Grp 1 state Init -> Backup

*Dec 12 11:30:36.243: % VRRP-6-statechange: GI0/0 Grp 1 state Backup -> Master

*Dec 12 11:50:39.395: % VRRP-6-statechange: GI1/0 Grp 2 state Master -> Backup

VRRP Packet Exchange

After VRRP is configured, it broadcasts a gratuitous ARP packet to check whether IP addresses conflict

A virtual router has a virtual MAC address. According to RFC2338, the virtual MAC address is in the format of 00-00-5e-00-01 -{VRID}. When a virtual router responds to an ARP request, the virtual MAC address is not the actual MAC address of the interface.

The master sends advertisement messages periodically, that is, once every second. If the backup server does not receive any Advertisement message from the master every three seconds, the backup server considers the master to be Down and launches a new election. It can also be seen that the multicast address is 224.0.0.18.

If pingR3’s loopback interface goes through R1 and then R3, what happens if R1’s G0/0 interface goes Down?

R1(config)#int g0/0

R1(config-if)#shutdown

*Dec 12 12:36:36.691: % VRRP-6-statechange: gi0/0 Grp 1 state Master -> Init

However, R2 did not receive the interactive data packet from R1 VRRP within three seconds, and R2 switched from Backup to Master. It can be seen from the packets and R2 logs

R2 logs:

*Dec 12 12:28:17.375: % VRRP-6-statechange: GI0/0 Grp 1 state Backup -> Master

We set up to monitor the upstream interface, and when the upstream interface goes Down we can see what happens, okay?

R1(config)#int g1/0

R1(config-if)#shutdown

The log shows that the status of VRRP2 changes to Init because the interface is Down. When the upstream g1/0 interface is Down, the status of VRRP1 changes from Master to Backup

*Dec 12 12:51:10.723: % VRRP-6-statechange: GI1/0 Grp 2 state Backup -> Init

*Dec 12 12:51:10.727: % tracking-5-state :1 interface GI1/0 line-protocol Up->Down

*Dec 12 12:51:16.183: % VRRP-6-statechange: GI0/0 Grp 1 state Master -> Backup

This is because when the g1/0 interface is Down, the priority value of VRRP is reduced by 30, resulting in the priority value of R2 being greater than that of R1

Tracing the route path from PC1, you can see that VRRP is automatically switched from R1 to R2

= = =