8.VRRP Principle
8.VRRP Principle
8.VRRP Principle
Foreword
⚫ Usually, all hosts in the same network segment set an identical default routing with the gateway as the
next hop. When the gateway fails, all hosts in this network segment with the gateway as the default
routing will not be able to communicate with the external network.
⚫ VRRP, which is Virtual Router Redundancy Protocol, is proposed by the IETF to solve the phenomenon
of a single point of failure in the configuration of a static gateway in a LAN.
1. VRRP Overview
⚫ Usually, all hosts in the same network segment are configured with the same gateway to access the
external network
⚫ When the only gateway device fails, all hosts are unable to communicate with the external network
External
Network
Failure
Layer 3 Gateway
IP: 10.1.1.1
PC1 PC2
Gateway IP: 10.1.1.1 Gateway IP: 10.1.1.1
Local IP: 10.1.1.10 Local IP: 10.1.1.11
⚫ We can add gateway devices, configure VRRP protocol, and provide device backup for the default
gateway to improve the reliability of the gateway
⚫ VRRP (Virtual Router Redundancy Protocol) forms a backup group of routers (or Layer 3 switches) to
form a virtual router with a virtual IP address, and assumes the gateway function
⚫ The virtual router will work as long as there is still a router working in the backup group
SWA
Virtual Gateway
External
Network
SWB
VRRP GROUP
1. VRRP Overview
⚫ The Master router is in VRRP backup group 1, VRRP priority 110, virtual IP address 192.168.10.254, and
default VRRP in preemption mode.
External
Network
SWA
SWB
Group1: Master
Group1: Backup
Group1
SVI 10: 192.168.10.252 Virtual Address: 192.168.10.254
SVI 10: 192.168.10.253
VRID: 1 VRID: 1
Priority: 110 Priority: 100
Virtual IP: 192.168.10.254 Virtual IP: 192.168.10.254
⚫ Priority:
➢ The router with the highest priority in the backup group will become the Master router (priority takes the value range 0-255)
➢ When the priority is the same, compare the primary IP address of the interface, the larger the address, the higher the priority
➢ Priority default value 100 with assignable range 1-254
➢ Note: If the virtual IP address of the VRRP group is the same as the IP on the interface it is on, then the device is considered to be
the IP address owner, with priority 255, and is automatically in the Master state.
⚫ Preemption Mode:
➢ If preemption mode is turned off, the high priority backup router will not actively become the active router, even if the active router
has a lower priority, and the backup router will become the primary router only when the active router fails.
➢ Preemption mode is mainly applied to ensure that high priority routers become active as soon as they are connected to the network
➢ By default, the preemption mode is turned on
Master Backup
backup Master
Compare priorities and IP
10.1.1.2 hello 10.1.1.3
hello
One becomes the master router, and the other becomes the backup
⚫ VRRP messages are multicast messages that are sent by the MASTER router at regular intervals to
announce its presence
⚫ Using VRRP messages to detect various parameters of virtual routers for MASTER router elections
⚫ VRRP packets are carried on top of IP packets, using protocol number 112
⚫ The IP multicast address used for VRRP packets is 224.0.0.18
F0/0 F0/0
⚫ Initialize: the router enters this state when it is just starting up, and enters other states after exchanging data through
VRRP messages
⚫ Master: A state of the current forwarded packets as determined by the routers in the VRRP group after exchanging
VRRP packets
⚫ Backup: A state in which the routers in a VRRP group are listening after exchanging VRRP messages
Initialize
Master Backup
Within the specified timeout period
No hello message received from master
Innovation • Simplicity • Experience
VRRP Interface Tracking
⚫ Monitor the specified interface and dynamically adjust the priority of this router based on the status of the monitored
interface
⚫ When the uplink is unavailable, the router VRRP priority will be reduced, the router will no longer be the Master, and
the backup router will become the new Master
Master Backup
Priority 150 Priority 100
Intranet
1. VRRP Overview
⚫ Example: Deploy VRRP on the aggregation switch so that the primary gateway for VLAN 10 is SWA and the backup
gateway is SWB
Configuring VRRP Groups on SWA
SWA SWA(config)#interface vlan 10
F1/1 Master
10.1.1.2/24 SWA(config-if-vlan10)#ip address 10.1.1.2 255.255.255.0
SWA(config-if-vlan10)#vrrp 10 ip 10.1.1.1
VRRP GROUP 10
Vitrual IP: 10.1.1.1 Extr
anet
PC
Configuring VRRP Groups on SWB
IP: 10.1.1.12 SWB
Gateway: 10.1.1.1 F1/2 Backup SWB(config)#interface vlan 10
10.1.1.3/24
SWB(config-if-vlan10)#ip address 10.1.1.3 255.255.255.0
SWB(config-if-vlan10)#vrrp 10 ip 10.1.1.1
⚫ Example: Deploying VRRP on an aggregation switch and set the priority so that the primary gateway for VLAN 10 is
SWA and the backup gateway is SWB
Configuring VRRP Groups on SWA
SWA(config)#interface vlan 10
SWA SWA(config-if-vlan10)#ip address 10.1.1.2 255.255.255.0
F1/1 Master
10.1.1.2/24 SWA(config-if-vlan10)#vrrp 10 ip 10.1.1.1
Configuring the interface priority on SWA to control the election of
⚫ VRRP can be configured based on link conditions when link load balancing is required in the network
⚫ As shown in the figure below: External
Network
⚫ VRRP Function: A group of routers (or Layer 3 switches) is formed into a backup group to generate a
virtual router that uses a virtual IP address to provide default gateway services for hosts.
⚫ VRRP Concepts: VRRP backup group, virtual router ID, virtual IP address, virtual MAC address,
MASTER router, BACKUP router.
⚫ VRRP Preemption: The router with the highest priority is the primary router, and if preemption is enabled
then when the failure is recovered, the high priority router will be actively called the active router.
⚫ VRRP Configuration Process: create VRRP group and configure virtual IP address - set VRRP Group
priority - set the interface to be monitored by VRRP backup group.