VRRP-Track-route management collaboration configuration example
Network requirements
As shown in Figure 41:
Host A requires access to Host B. The default gateway of Host A is 10.1.1.10/24.
Router A and Router B belong to VRRP group 1. The virtual IP address of VRRP group 1 is 10.1.1.10.
BGP peer relationships are established between Router A and Router C and between Router B and Router D. Router C and Router D advertise default route 0.0.0.0/0 to Router A and Router B.
Configure VRRP-Track-route management collaboration to meet the following requirements:
When Router A operates correctly, Router A forwards packets from Host A to Host B.
When VRRP detects the removal of the default route from the routing table of Router A through route management, Router B forwards packets from Host A to Host B.
Figure 41: Network diagram
Configuration procedure
Configure the IP address of each interface, as shown in Figure 41. (Details not shown.)
Establish an IBGP peer relationship between Router A and Router C, and configure Router C to advertise default route 0.0.0.0/0 to Router A.
<RouterA> system-view [RouterA] bgp 100 [RouterA-bgp-default] peer 10.1.2.2 as-number 100 [RouterA-bgp-default] address-family ipv4 [RouterA-bgp-default-ipv4] peer 10.1.2.2 enable <RouterC> system-view [RouterC] bgp 100 [RouterC-bgp-default] peer 10.1.2.1 as-number 100 [RouterC-bgp-default] address-family ipv4 [RouterC-bgp-default-ipv4] peer 10.1.2.1 enable [RouterC-bgp-default-ipv4] peer 10.1.2.1 default-route-advertise [RouterC-bgp-default-ipv4] quit
Configure Router B and Router D in the same way Router A and Router C are configured. (Details not shown.)
Configure Track and VRRP on Router A:
# Configure track entry 1, and associate it with default route 0.0.0.0/0.
[RouterA] track 1 ip route 0.0.0.0 0.0.0.0 reachability [RouterA-track-1] quit
# Create VRRP group 1, and configure virtual IP address 10.1.1.10 for the group.
[RouterA] interface gigabitethernet 1/0/1 [RouterA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.10
# Set the priority of Router A to 110 in VRRP group 1.
[RouterA-GigabitEthernet1/0/1] vrrp vrid 1 priority 110
# Associate VRRP group 1 with track entry 1 and decrease the router priority by 30 when the state of track entry 1 changes to negative.
[RouterA-GigabitEthernet1/0/1] vrrp vrid 1 track 1 priority reduced 30 [RouterA-GigabitEthernet1/0/1] quit
On Router B, create VRRP group 1, and configure virtual IP address 10.1.1.10 for the group.
<RouterB> system-view [RouterB] interface gigabitethernet 1/0/1 [RouterB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.10 [RouterB-GigabitEthernet1/0/1] quit
Verifying the configuration
# Ping Host B from Host A to verify that Host B is reachable. (Details not shown.)
# Display detailed information about VRRP group 1 on Router A.
[RouterA] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 0 Auth Type : None Virtual IP : 10.1.1.10 Virtual MAC : 0000-5e00-0101 Master IP : 10.1.1.1 VRRP Track Information: Track Object : 1 State : Positive Pri Reduced : 30
# Display detailed information about VRRP group 1 on Router B.
[RouterB] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 0 Become Master : 2200ms left Auth Type : None Virtual IP : 10.1.1.10 Master IP : 10.1.1.1
The output shows that in VRRP group 1, Router A is the master and Router B is a backup. Router A forwards packets from Host A to Host B.
# Disable Router C from exchanging routing information with Router A so that default route 0.0.0.0/0 is removed from Router A.
[RouterC-bgp-default-ipv4] undo peer 10.1.2.1 enable
# Ping Host B from Host A to verify that Host B is reachable. (Details not shown.)
# Display detailed information about VRRP group 1 on Router A.
[RouterA] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 110 Running Pri : 80 Preempt Mode : Yes Delay Time : 0 Become Master : 2200ms left Auth Type : None Virtual IP : 10.1.1.10 Master IP : 10.1.1.2 VRRP Track Information: Track Object : 1 State : Negative Pri Reduced : 30
# Display detailed information about VRRP group 1 on Router B.
[RouterB] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 0 Auth Type : None Virtual IP : 10.1.1.10 Virtual MAC : 0000-5e00-0101 Master IP : 10.1.1.2
The output shows that Router A becomes the backup, and Router B becomes the master. Router B forwards packets from Host A to Host B.