What is VRRP

Overview of VRRP

●Using VRRP, a group of routers (interfaces in the same LAN) work together, but there is only one router (interface) in the Master state, and the router (interface) in this state is responsible for the actual data traffic forwarding task. Multiple router interfaces in a VRRP group share a virtual IP address, which is used as the default gateway address of all hosts in the LAN.

●VRRP determines which router is the Master, and the Master router receives and forwards data packets sent to the user's gateway (that is, to the virtual IP address mentioned above), and responds to the PC's ARP request for its gateway.

●The Backup router listens to the status of the Master router, and takes over its work when the Master router fails, so as to ensure the smooth switching of services

The role of VRRP

The role of VRRP: Provides a device backup mechanism on the LAN. VRRP is a fault-tolerant protocol. It ensures that when the next-hop router of a host fails, it can be replaced by another router in time, thereby ensuring the continuity and reliability of communication.
When VRRP works, a virtual router with a virtual IP and virtual MAC address is added to the network. The router acts as a gateway for network users, so that hosts on the network communicate with the virtual router without knowing any information about the physical router on the network.

Master message sending: When the Master is working normally, it will send vrrp notification messages to the backup devices in the group at regular intervals (the default value is one second) to notify that it is working normally. (Note: Only the Master sends the vrrp message) The
VRRP notification message is encapsulated in an IP message, and the multicast address 244.0.0.18 is notified to be sent, the TTL is 255, and the protocol number is 112.

VRRP status

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

VRRP working process

The basis for the election of active and standby routers: first compare the priority size (larger ratio), and if they are equal, compare the interface IP address (larger ratio).
For example, in the figure below, the middle is a virtual router, and the virtual address is the gateway. vrrp will select one of R1 and R2 as the main router and the other as the backup. When R1 is the main router, if its g0/0/0 port is down Or the switch is broken, then the vrrp protocol will re-select R2 as the master router to make the network work normally.
Insert picture description here
VRRP configuration commands
R1

[R1] int vlanif 10
gateway interface (Layer 3 switch VLAN interface, router is the downstream interface)

【R1-Vlanif10】ip address 192.168.10.11 24

[R1-Vlanif10] vrrp vrid 1 virtual-ip 192.168.10.1
Create a VRRP virtual router with the identification vrid of 1, and configure the virtual IP address of vrid 1

[R1-Vlanif10] vrrp vrid 1 priority 120
Set the priority of device A to 120 (the default value is 100), the larger the value, the more priority

[R1-vlanif10] vrrp vrid 1 preempt-mode timer delay 6
Configure the preemption delay of the master device to 6 seconds (the default value is 0, preempt immediately) to prevent frequent state switching

[R1-V1anif10] vrrp vrid 1 track interface GigabitEthernet0/0/1 reduce 30
Track the status of the uplink interface G0/0/0, if the port fails, the Master priority will be reduced by 30 (default value is 10)

[R1-Vlanif10] vrrp vrid 1 track interface g0/0/2 to
track the downlink interface (tracking is optional)

Note: The upstream port is from the router to the server, and the
downstream port is from the router to the PC.
R2
【R2】int vlanif 10
【R2-vlanif10】ip add 192.168.10.10 24
【R2-vlanif10】vrrp vrid 1 virtual-ip 192.168.10.1
【 R2-vlanif10】vrrp vrid 1 priority 115

[R2] dis vrrp display vrrp status

PC test verification, tracert 10.0.0.1

Optional:
[R1-vlanif10] vrrp vrid preempt-mode timer delay 6 It is
recommended that the backup device be set to preempt immediately, the master device is set to delay preemption, and a certain delay time is specified. The purpose of this configuration is to set the network environment unstable , Wait for a certain period of time for the state of the uplink and downlink to restore consistency, so as to avoid dual-master devices or frequent preemption by both the active and standby parties, which causes the user equipment to learn the wrong master device MAC address.

Guess you like

Origin blog.csdn.net/zhangyuebk/article/details/112292823