VRRP Lab
VRRP Lab
Learning Objectives
Topology
Scenario
Tasks
<Huawei>system-view
[Huawei]sysname R1
[R1]interface loopback 0
[R1-LoopBack0]quit
<Huawei>system-view
[Huawei]sysname R2
[R2-GigabitEthernet0/0/0]quit
<Huawei>system-view
[Huawei]sysname R3
[R3-GigabitEthernet0/0/0]quit
<Huawei>system-view
[Huawei]sysname R4
<Huawei>system-view
[Huawei]sysname R5
After the configuration is complete, test the connectivity between R1 and R2 and
between R1 and R3.
[R1]ping 10.0.123.2
5 packet(s) transmitted
5 packet(s) received
[R1]ping 10.0.123.3
5 packet(s) transmitted
5 packet(s) received
Test the connectivity between R2, R3, R4, and R5. R2 is used as an example.
[R2]ping 192.168.1.3
5 packet(s) transmitted
5 packet(s) received
[R2]ping 192.168.1.4
5 packet(s) transmitted
5 packet(s) received
[R2]ping 192.168.1.5
5 packet(s) transmitted
5 packet(s) received
The loopback interface on R1 and connected interfaces on R1, R2, and R3 run in
OSPF area 0. Routes of interfaces on R2 and R3 connecting to S1 are advertised to
OSPF, but no OSPF neighbor relationships. The silent mode is therefore used.
To simulate PCs, R4 and R5 use default static routes pointing to 192.168.1.1 (VRRP
virtual IP address).
[R1]ospf 1
[R1-ospf-1]area 0
[R2]ospf 1
[R2-ospf-1]area 0
[R3]ospf 1
[R3-ospf-1]area 0
After the configuration is complete, check the routing table ofR1, R2, and R4.
[R1]display ip routing-table
------------------------------------------------------------------------------
Destinations : 9 Routes : 10
[R2]display ip routing-table
------------------------------------------------------------------------------
Destinations : 12 Routes : 12
[R4]display ip routing-table
------------------------------------------------------------------------------
Destinations : 9 Routes : 9
The preceding output shows that R1 can learn routes to 192.168.1.0/24, R2 can learn
routes to 1.1.1.1/32, and R4 has a default static route to 192.168.1.1.
Enable VRRP on interfaces of R2 and R3, and configure the VRID and virtual IP
address.
R2 is configured first and becomes the master router if there is no other member in
the VRRP group after a period of time.
After the configuration is complete, check the VRRP status on R2 and R3.
[R2]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
[R3]display vrrp
State : Backup
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
R2 is selected as the master router and R3 as the backup router. The priorities of
master and slave routers are both 100. When R3 is started first, it becomes the
master router, which is not expected.
Configure VRRP priorities on R2 and R3. A greater priority value indicates a higher
priority. Set VRRP priorities of R2 and R3 to 120 and 110, respectively.
[R2]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
[R3]display vrrp
State : Backup
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 110
PriorityConfig : 110
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
The preceding output shows that priorities of R2 and R3 have been changed
successfully. By default, VRRP preemption is enabled. When the priority of R3 is
changed to be higher, an active/standby switchover will be triggered.
[R4]ping 1.1.1.1
5 packet(s) transmitted
5 packet(s) received
The preceding output shows that the virtual gateway works properly and can
forward data of the LAN where R4 is located to R1. Normally, the master router
forwards data, so traffic passes through R2. To verify the switching status, perform
the ping operation from R4 to R1 for a long time and shut down the interface of R2
connected to S1.
[R2-GigabitEthernet0/0/1]shutdown
R4 discards two data packets during the switchover, and subsequent data is
forwarded normally.
20 packet(s) transmitted
18 packet(s) received
[R3]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.3
PriorityRun : 110
PriorityConfig : 110
MasterPriority : 110
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
If the fault occurs on the uplink link, the active/standby switchover is not performed.
In this case, all Internet access traffic cannot be forwarded after reaching R2. VRRP is
enabled to monitor the uplink. When the uplink fails, R2 automatically reduces its
priority. R3 preempts to be the master router, and traffic is switched to the backup
router and backup uplink.
Before configuring VRRP to monitor the uplink, restore the link that is shut down.
Configure VRRP to monitor the uplink interface and set the value by which the
priority decreases to 30. That is, when the link fails, the priority of R2 becomes 90,
which is lower than the priority of R3 (110).
[R2-GigabitEthernet0/0/1]undo shutdown
[R2]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
IF state : UP
Perform the ping operation on R4 for a long time and shut down the uplink interface
on R2.
[R2-GigabitEthernet0/0/0]shutdown
[R2]display vrrp
State : Backup
Virtual IP : 192.168.1.1
Master IP : 192.168.1.3
PriorityRun : 90
PriorityConfig : 120
MasterPriority : 110
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
IF state : DOWN
[R3]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.3
PriorityRun : 110
PriorityConfig : 110
MasterPriority : 110
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
Restore the uplink and priority of R2. R2 preempts to be the master router again.
During preemption, few packets are discarded on R4. This is because OSPF routes
are not converged rapidly. For details about route convergence acceleration, see the
OSPF experiment.
[R2-GigabitEthernet0/0/0]undo shutdown
[R2]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
IF state : UP
When the interface goes Up, the OSPF neighbor relationship needs to be
reestablished on the uplink interface of R2. If OSPF fast convergence is not
configured, data cannot be forwarded for several seconds. You are advised to set the
preemption delay to be longer than the OSPF convergence time during the
switchback.
Check the VRRP configurations again. You can see that the preemption delay has
been configured successfully.
[R2]display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
IF state : UP
Normally, the master device forwards all traffic, and the backup device is idle.
gateways.
<R2>display vrrp
State : Master
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
IF state : UP
State : Backup
Virtual IP : 192.168.1.254
Master IP : 192.168.1.3
PriorityRun : 110
PriorityConfig : 110
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
<R3>display vrrp
State : Backup
Virtual IP : 192.168.1.1
Master IP : 192.168.1.2
PriorityRun : 110
PriorityConfig : 110
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
State : Master
Virtual IP : 192.168.1.254
Master IP : 192.168.1.3
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
TimerRun : 1 s
TimerConfig : 1 s
Backup-forward : disabled
IF state : UP
Perform the tracert operation to check the gateways that process data destined for
the two default routes. You can see that data sent by R4 is forwarded by the master
device in VRRP group 1 and data sent by R5 is forwarded by the master device in
VRRP group 2.
<R4>tracert 1.1.1.1
o break
1 192.168.1.2 80 ms 40 ms 40 ms
2 10.0.123.1 100 ms 70 ms 70 ms
<R5>tracert 1.1.1.1
o break