The Virtual Router Redundancy Protocol (VRRP) is a fault tolerant protocol, and it groups several routers into a virtual router. If the next hop router of a host is defective, VRRP uses a mechanism to switch traffic to another router. This ensures continuity and reliability of communications.
In this example, by configuring a VRRP backup group in master/backup mode, you can use the master device of the VRRP backup group to transmit all network traffic.
Networking Requirements
As shown in Figure 1, Host A accesses Host B through the default gateway.
The requirements are as follows:
-
CX-A and CX-B form a VRRP backup group that serves as the default gateway for Host A.
-
Normally, CX-A serves as the gateway. When CX-A fails, CX-B serves as the gateway.
-
CX-A continues to function as the master CX device within 20 seconds after it recovers.
Configuration Roadmap
The configuration roadmap is as follows:
-
Create the backup group 1 on the GE 2/0/0 on CX-A and configure CX-A with the highest priority in the backup group to be the master CX device. Configure the preemption mode.
-
Create backup group 1 on the GE 2/0/0 interface on CX-B and use the default priority.
Data Preparation
To complete the configuration, you need the following data:
-
Virtual router ID and virtual IP address
-
Priority of each CX device in the backup group
-
Preemption mode
Procedure
- Configure network interconnection between devices.
# Configure the default gateway of Host A with 10.1.1.111 and the default gateway of Host B with 20.1.1.1.# Configure CX-A, CX-B and CX-C to use OSPF for interconnection.
- Configure VRRP.
# On CX-A, configure the IP address of the interface, create backup group 1 and configure the priority of CX-A in this group with 120 (as the master CX device).
<CX-A> system-view
[CX-A] interface gigabitethernet 2/0/0
[CX-A-GigabitEthernet2/0/0] undo shutdown
[CX-A-GigabitEthernet2/0/0] ip address 10.1.1.1 24
[CX-A-GigabitEthernet2/0/0] vrrp vrid 1 virtual-ip 10.1.1.111
[CX-A-GigabitEthernet2/0/0] vrrp vrid 1 priority 120
[CX-A-GigabitEthernet2/0/0] vrrp vrid 1 preempt-mode timer delay 20
[CX-A-GigabitEthernet2/0/0] quit
[CX-A] quit
# On CX-B, configure the IP address of the interface, create backup group 1 and configure the priority of CX-B in this group with the default value 100 (as the backup CX device).<CX-B> system-view
[CX-B] interface gigabitethernet 2/0/0
[CX-B-GigabitEthernet2/0/0] undo shutdown
[CX-B-GigabitEthernet2/0/0] ip address 10.1.1.2 24
[CX-B-GigabitEthernet2/0/0] vrrp vrid 1 virtual-ip 10.1.1.111
[CX-B] quit
- Verify the configuration.
-
Check that the VRRP backup group can serve as a gateway.After the previous configuration, Host A can ping through Host B.Running the display vrrp command on CX-A, you can view that the status of CX-A is Master. Running thedisplay vrrp command on CX-B, you can view that the CX-B is Backup.
<CX-A> display vrrp
GigabitEthernet2/0/0 | Virtual CX-1
state : Master
Virtual IP : 10.1.1.111
Master IP : 10.1.1.1
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20
TimerRun : 1
TimerConfig : 1
Auth Type : NONE
Virtual Mac : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
<CX-B> display vrrp
GigabitEthernet2/0/0 | Virtual CX-1
state : Backup
Virtual IP : 10.1.1.111
Master IP : 10.1.1.1
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0
TimerRun : 1
TimerConfig : 1
Auth Type : NONE
Virtual Mac : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Running the display ip routing-table command on CX-A and CX-B, you can view a direct route with the destination address being the virtual IP address on CX-A, and an OSPF route to the same destination on CX-B.The displays on CX-A and CX-B are as follows.<CX-A> display ip routing-table
Route Flags: R - relied, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet2/0/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
10.1.1.111/32 Direct 0 0 D 127.0.0.1 InLoopBack0
20.1.1.0/24 OSPF 10 2 D 192.168.1.2 Pos1/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Pos1/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.2/32 Direct 0 0 D 192.168.1.2 Pos1/0/0
192.168.2.0/24 OSPF 10 2 D 10.1.1.2 GigabitEthernet2/0/0
<CX-B> display ip routing-table
Route Flags: R - relied, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.2 InLoopBack0
10.1.1.2/32 Direct 0 0 D 127.0.0.1 InLoopBack0
10.1.1.111/32 OSPF 10 2 D 10.1.1.1 InLoopBack0
20.1.1.0/24 OSPF 10 2 D 192.168.2.2 Pos1/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 OSPF 10 2 D 10.1.1.1 GigabitEthernet2/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.1 Pos1/0/0
192.168.2.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.2.2/32 Direct 0 0 D 192.168.2.2 Pos1/0/0
-
Check whether CX- B can become the master when CX-A fails.To simulate the election of the master CX device when CX-A fails, run the shutdown command on the GE 2/0/0 on CX-A.Running the display vrrp command on CX-B to view the VRRP status, you can view that CX-B is in the Master state. The command output is as follows:
<CX-B> display vrrp
GigabitEthernet2/0/0 | Virtual CX-1
state : Master
Virtual IP : 10.1.1.111
Master IP : 10.1.1.2
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0
TimerRun : 1
TimerConfig : 1
Auth Type : NONE
Virtual Mac : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
-
Check that CX-A can perform preemption after recovering.Run the undo shutdown command on GE 2/0/0. On CX-A, run the display vrrp command to view VRRP status 20 seconds after GE 2/0/0 being Up. You can view that CX-A restores to be the master CX device.
-
Configuration Files
-
Configuration file of CX-A
#
sysname CX-A
#
interface GigabitEthernet2/0/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.111
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 20
#
interface Pos1/0/0
link-protocol ppp
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 10.1.1.0 0.0.0.255
#
return
-
Configuration file of CX-B
#
sysname CX-B
#
interface GigabitEthernet2/0/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.111
#
interface Pos1/0/0
link-protocol ppp
undo shutdown
ip address 192.168.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.2.0 0.0.0.255
network 10.1.1.0 0.0.0.255
#
return
-
Configuration file of CX-C
#
sysname CX-C
#
interface Ethernet3/0/0
undo shutdown
ip address 20.1.1.1 255.255.255.0
#
interface Pos1/0/0
link-protocol ppp
undo shutdown
ip address 192.168.1.2 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
undo shutdown
ip address 192.168.2.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 20.1.1.0 0.0.0.255
#
return
from the best of networking http://ift.tt/1AR2dhs
(Visited 325 times, 1 visits today)