“VRRP” Virtual Router Redundancy Protocol

VRRP

  • 1. Overview of VRRP:
  • 2. VRRP terms:
            • 1. VRRP router:
            • 2. VRRP group:
            • 3. Virtual router:
            • 4. Virtual ip address, MAC address:
            • 5.Master, Backup router:
            • 6. VRRP state machine:
  • 3. The working principle of VRRP:

1. Overview of VRRP:

  • Virtual Router Redundancy Protocol, that is, virtual router redundancy protocol.

  • Using VRRP, a group of routers (interfaces in the same LAN) work together, but only one is in the master state, and the router (interfaces) in this state undertakes the actual data traffic forwarding task. Multiple router interfaces in a VRRP group share a virtual IP address, which is called the default gateway address of the host in the LAN.
    *

  • VRRP determines which router is the Master. The Master router is responsible for receiving and forwarding data packets sent to the user gateway, and responding to the ARP request of the PC for its gateway IP address.

  • The Backup router listens to the status of the Master router, and takes over the work of the Master router when it fails, thus ensuring smooth switching of service traffic.

Two. VRRP terms:

1.VRRP router:

A router running VRRP, a VRRP router (interface) can participate in multiple VRRP groups at the same time, in different groups, a VRRP router can play different roles.

2.VRRP group:

A VRRP group consists of multiple VRRP routers, which are identified by the same VRID (Virtual Router ID, virtual router id). VRRP routers belonging to the same VRRP group exchange information with each other. Each VRRP group can only have one Master.

3. Virtual router:

For each VRRP group, a logical router is abstracted. This router acts as a gateway for network users. This router does not really exist. In fact, for users, they only need to know the ip of the virtual router. As for the role of the specific virtual router, it is determined by Who will be responsible, who will be responsible for data forwarding, and who will take over after the Master fails. This is the job of VRRP.

4. Virtual ip address, MAC address:

Virtual ip address is the ip address of the virtual router, which is actually the gateway address of the Internet user.
Virtual MAC address is the MAC address generated by the virtual router according to the VRID. A virtual router has a virtual MAC address in the format: 00-00-5E-00-01-(VRID).

5.Master, Backup router:

Master router: The router that actually forwards data packets in the VRRP group. In each VRRP group, only the Master responds to the ARP request for the IP address. At the same time, the Master router sends VRRP messages at certain intervals to notify the Backup router of its survival.
Backup router: The router in the listening state. Once the Master router fails, the Backup router will start to take over.
Election basis: first compare the interface VRRP priority (bigger), if they are equal, then compare the interface IP address (bigger).

6.VRRP state machine:

There are three states of the VRRP protocol, namely Initialize, Master, and Backup. The initial state is Initialize. The Master and Backup are generated by comparing the priorities. If the Backup does not receive the heartbeat message from the Master within the specified time, it will Switch to Master.

3. The working principle of VRRP:

(1). The devices in the VRRP group elect the Master. The master device notifies the device or host connected to it of the virtual MAC address by sending an ARP message, so as to undertake the task of message forwarding.
(2). The Master device periodically sends VRRP notification messages to all Backup devices in the backup group.
(3). If the master device fails, the backup device in the VRRP backup group re-elects a new master.
(4). When the state of the VRRP group is switched, the Master device is switched from one device to another, and the new Master device will immediately send a gratuitous ARP message carrying the virtual MAC address and virtual IP address information of the virtual router =, refresh The MAC entry in the host or device connected to it directs user traffic to the new Master device, and the whole process is completely transparent to the user.
(5). When the original Master device recovers from failure, if the device is the owner of the IP address (then its priority is 255), it will directly switch to the Master state. If the priority of the device is less than 255, it will switch to the Backup state first, and its priority will return to the priority configured before the failure.
(6). When the priority of the Backup device is higher than that of the Master device, the working mode of the Backup device (preemption mode and non-preemption mode) determines whether to re-elect the Master device.

VRRP experiment exercise:

Configure R1:

[R1]INT G0/0/0 //Enter interface
[R1-GigabitEthernet0/0/0]IP ADD 192.168.0.254 24 //configure interface ip
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]UN SHU
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]INT G0/0/1
[R1-GigabitEthernet0/0/1]IP ADD 10.0.0.1 24
[R1-GigabitEthernet0/0/1]UN SHU
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]INT G0/0/0
[R1-GigabitEthernet0/0/0]VRRP VRID 1 VIRTUAL-IP 192.168.0.1 //Create a VRRP virtual router with the ID VRID as 1, and configure the virtual IP address of VRID 1
[R1i-GigabitEthernet0/0/0]VRRP VRID 1 PRIORITY 120 //Set the priority of MASTER router R1 to 120 (the default value is 100, the larger the value, the higher the priority)
[R1-GigabitEthernet0/0/0]VRRP VRID 1 PREEMPT-MODE TIMER DELAY 5 //Configure the preemption delay of MASTER router R1 to 5 seconds (the default value is 0 to prevent frequent state switching)
[R1-GigabitEthernet0/0/0]VRRP VRID 1 TRACK INTERFACE G0/0/1 REDUCED 30 //Track the state of the uplink interface G0/0/1, if the port fails, the MASTER will be reduced by 30 first (the default value is 10)
[R1-GigabitEthernet0/0/0]Q
[R1]IP ROUTE-STATIC 30.0.0.0 24 10.0.0.3 //Destination address mask next hop address
[R1]Q

Configure R2:

<Huawei>sys
Enter system view, return user view with Ctrl + Z.
[Huawei]sys R2
[R2]INT G0/0/0
[R2-GigabitEthernet0/0/0]IP ADD 192.168.0.253 24
[R2-GigabitEthernet0/0/0]INT G0/0/1
[R2-GigabitEthernet0/0/1]IP ADD 20.0.0.1 24
[R2-GigabitEthernet0/0/1]Q
[R2]INT G0/0/0
[R2-GigabitEthernet0/0/0]VRRP VRID 1 VIRTUAL-IP 192.168.0.1 // Create a VRRP virtual router with the ID VRID 1 and configure the virtual IP address of VRID 1
[R2-GigabitEthernet0/0/0]Q
[R2]IP ROUTE-STATIC 30.0.0.0 24 20.0.0.3 //Destination address mask next hop address
[R2]

Configure R3:

[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 10.0.0.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 20.0.0.3 24
[R3-GigabitEthernet0/0/1]un shu
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R3-GigabitEthernet0/0/1]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 30.0.0.3 24
[R3-GigabitEthernet0/0/2]q
[R3] ip route-static 192.168.0.0 24 10.0.0.1 preference 70
[R3] ip route-static 192.168.0.0 24 20.0.0.1
[R3]

Finally configure three hosts: