Static routing-Track-BFD collaboration configuration example
Network requirements
As shown in Figure 39:
Router A is the default gateway of the hosts in network 20.1.1.0/24.
Router B is the default gateway of the hosts in network 30.1.1.0/24.
Hosts in the two networks communicate with each other through static routes.
To ensure network availability, configure route backup and static routing-Track-BFD collaboration on Router A and Router B as follows:
On Router A, assign a higher priority to the static route to 30.1.1.0/24 with next hop Router B. This route is the master route. The static route to 30.1.1.0/24 with next hop Router C acts as the backup route. When the master route is unavailable, BFD can quickly detect the route failure to make the backup route take effect.
On Router B, assign a higher priority to the static route to 20.1.1.0/24 with next hop Router A. This route is the master route. The static route to 20.1.1.0/24 with next hop Router C acts as the backup route. When the master route is unavailable, BFD can quickly detect the route failure to make the backup route take effect.
Figure 39: Network diagram
Configuration procedure
Configure the IP address of each interface, as shown in Figure 39. (Details not shown.)
Configure Router A:
# Configure a static route to 30.1.1.0/24 with next hop 10.2.1.2 and the default priority (60). Associate this static route with track entry 1.
<RouterA> system-view [RouterA] ip route-static 30.1.1.0 24 10.2.1.2 track 1
# Configure a static route to 30.1.1.0/24 with next hop 10.3.1.3 and priority 80.
[RouterA] ip route-static 30.1.1.0 24 10.3.1.3 preference 80
# Specify 10.10.10.10 as the source address of BFD echo packets.
[RouterA] bfd echo-source-ip 10.10.10.10
# Configure track entry 1, and associate it with the BFD session to verify the connectivity between Router A and Router B.
[RouterA] track 1 bfd echo interface gigabitethernet 1/0/1 remote ip 10.2.1.2 local ip 10.2.1.1 [RouterA-track-1] quit
Configure Router B:
# Configure a static route to 20.1.1.0/24 with next hop 10.2.1.1 and the default priority (60). Associate this static route with track entry 1.
<RouterB> system-view [RouterB] ip route-static 20.1.1.0 24 10.2.1.1 track 1
# Configure a static route to 20.1.1.0/24 with next hop 10.4.1.3 and priority 80.
[RouterB] ip route-static 20.1.1.0 24 10.4.1.3 preference 80
# Specify 1.1.1.1 as the source address of BFD echo packets.
[RouterB] bfd echo-source-ip 1.1.1.1
# Configure track entry 1, and associate it with the BFD session to verify the connectivity between Router B and Router A.
[RouterB] track 1 bfd echo interface gigabitethernet 1/0/1 remote ip 10.2.1.1 local ip 10.2.1.2 [RouterB-track-1] quit
Configure Router C:
# Configure a static route to 30.1.1.0/24 with next hop 10.4.1.2.
<RouterC> system-view [RouterC] ip route-static 30.1.1.0 24 10.4.1.2
# Configure a static route to 20.1.1.0/24 with next hop 10.3.1.1.
[RouterB] ip route-static 20.1.1.0 24 10.3.1.1
Verifying the configuration
# Display information about the track entry on Router A.
[RouterA] display track all Track ID: 1 State: Positive Duration: 0 days 0 hours 0 minutes 32 seconds Tracked object type: BFD Notification delay: Positive 0, Negative 0 (in seconds) Tracked object: BFD session mode: Echo Outgoing interface: GigabitEthernet1/0/1 VPN instance name: -- Remote IP: 10.2.1.2 Local IP: 10.2.1.1
The output shows that the status of the track entry is Positive, indicating that next hop 10.2.1.2 is reachable.
# Display the routing table of Router A.
[RouterA] display ip routing-table Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost NextHop Interface 10.2.1.0/24 Direct 0 0 10.2.1.1 GE1/0/1 10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0 10.3.1.0/24 Direct 0 0 10.3.1.1 GE1/0/2 10.3.1.1/32 Direct 0 0 127.0.0.1 InLoop0 20.1.1.0/24 Direct 0 0 20.1.1.1 GE1/0/3 20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0 30.1.1.0/24 Static 60 0 10.2.1.2 GE1/0/1 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The output shows that Router A forwards packets to 30.1.1.0/24 through Router B. The master static route has taken effect.
# Remove the IP address of GigabitEthernet 1/0/1 on Router B.
<RouterB> system-view [RouterB] interface gigabitethernet 1/0/1 [RouterB-GigabitEthernet1/0/1] undo ip address
# Display information about the track entry on Router A.
[RouterA] display track all Track ID: 1 State: Negative Duration: 0 days 0 hours 0 minutes 32 seconds Tracked object type: BFD Notification delay: Positive 0, Negative 0 (in seconds) Tracked object: BFD session mode: Echo Outgoing interface: GigabitEthernet1/0/1 VPN instance name: -- Remote IP: 10.2.1.2 Local IP: 10.2.1.1
The output shows that the status of the track entry is Negative, indicating that next hop 10.2.1.2 is unreachable.
# Display the routing table of Router A.
[RouterA] display ip routing-table Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost NextHop Interface 10.2.1.0/24 Direct 0 0 10.2.1.1 GE1/0/1 10.2.1.1/32 Direct 0 0 127.0.0.1 InLoop0 10.3.1.0/24 Direct 0 0 10.3.1.1 GE1/0/2 10.3.1.1/32 Direct 0 0 127.0.0.1 InLoop0 20.1.1.0/24 Direct 0 0 20.1.1.1 GE1/0/3 20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0 30.1.1.0/24 Static 80 0 10.3.1.3 GE1/0/2 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The output shows that Router A forwards packets to 30.1.1.0/24 through Router C. The backup static route has taken effect.
# Verify that the hosts in 20.1.1.0/24 can communicate with the hosts in 30.1.1.0/24 when the master route fails.
[RouterA] ping -a 20.1.1.1 30.1.1.1 Ping 30.1.1.1: 56 data bytes, press CTRL_C to break Reply from 30.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms Reply from 30.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 30.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 30.1.1.1: bytes=56 Sequence=4 ttl=254 time=2 ms Reply from 30.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms --- Ping statistics for 30.1.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.00% packet loss round-trip min/avg/max/std-dev = 1/1/2/1 ms
# Verify that the hosts in 30.1.1.0/24 can communicate with the hosts in 20.1.1.0/24 when the master route fails.
[RouterB] ping -a 30.1.1.1 20.1.1.1 Ping 20.1.1.1: 56 data bytes, press CTRL_C to break Reply from 20.1.1.1: bytes=56 Sequence=1 ttl=254 time=2 ms Reply from 20.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 20.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 20.1.1.1: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 20.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms --- Ping statistics for 20.1.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.00% packet loss round-trip min/avg/max/std-dev = 1/1/2/1 ms