HCIEFRR+BFD+OSPF and BGP linkage

Directory

    • 1. Experimental topology
    • 2. Key Agreements
      • 2.1 FRR
      • 2.2 BFD
      • 2.3 OSPF and BGP linkage
    • 3. Experimental goals
    • 4. Configuration script
      • 4.1 Configure IP
      • 4.2 Configure OSPF
      • 4.3 Configure BGP
      • 4.4 Configure FRR
      • 4.5 Configure BFD
      • 4.6 Configure Stub Router
    • 5. Summary

1. Experimental topology

2. Key Agreement

2.1 FRR

  • OSPF IP FRR is dynamic IP FRR. It uses the LFA (Loop-Free Alternates) algorithm to pre-calculate the backup path and save it in the forwarding table to quickly switch the traffic to the backup link in case of failure to ensure that the traffic is not interrupted. To achieve the purpose of traffic protection, this function can reduce the fault recovery time to less than 50 ms.

  • The basic idea of LFA for calculating backup links is to use the neighbor that can provide backup links as the root node and use the SPF algorithm to calculate the shortest distance to the destination node. Then, calculate the backup link with minimum cost and no loop according to the inequality.

2.2 BFD

  • BFD is a network protocol used to detect faults between two forwarding points. It is a bidirectional forwarding detection mechanism that can provide millisecond-level detection and realize rapid detection of links. BFD can achieve this by linking with upper-layer routing protocols. Rapid route convergence ensures business continuity.

2.3 OSPF and BGP linkage

  • OSPF and BGP are associated. A device with OSPF and BGP association enabled will remain a stub router within the set association time. That is to say, the link metric value in the LSA published by the device is the maximum value (65535). This tells other OSPF devices not to use this router to forward data.

3. Experimental objectives

  • Configure IP. The interconnection address between device Ra and device Rb is planned according to ab.1.1.a/24 and ab.1.1.b/24 (a
  • Each device has a loopback port Loopback0. The address of device Ra is a.a.a.a/32. For example, R1 has Lo0: 1.1.1.1/32.
  • The OSPF process number is 1, the RID is manually set to the Lo0 address, and OSPF is enabled on the interface. For the g0/0/1 port of R1, the cost value is set to 10.
  • Configure BGP. R1, R2, R3 and R4 are located in AS100 and are fully interconnected. R3 and R5 establish EBGP neighbors. 1.1.1.1 is announced in R3BGP.
  • Configure FRR so that R1 has a backup link and NexthopBak and OutIfBak appear in the FIB table of R1.
  • Configure BFD so that after R2 is shut down, R1 can still converge quickly (without packet loss).
  • Configure the association between OSPF and BGP so that R1 will not lose packets after R2 restarts.

4. Configuration script

4.1 Configure IP

R1

[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 14.1.1.1 255.255.255.0
[R1-LoopBack0]interface LoopBack0
[R1-LoopBack0]ip address 1.1.1.1 32

R2

[Huawei]sysname R2
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.1.1.2 24
[R2-GigabitEthernet0/0/1]interface LoopBack0
[R2-LoopBack0]ip add 2.2.2.2 32

R3

[Huawei]sysname R3
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.1.1.3 24
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.3 24
[R3-GigabitEthernet0/0/1]interface g0/0/2
[R3-GigabitEthernet0/0/2]ip add 35.1.1.3 24
[R3-GigabitEthernet0/0/2]interface LoopBack0
[R3-LoopBack0]ip add 3.3.3.3 32

R4

[Huawei]sysname R4
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip add 34.1.1.4 24
[R4-GigabitEthernet0/0/0]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip add 14.1.1.4 24
[R4-GigabitEthernet0/0/1]interface LoopBack0
[R4-LoopBack0]ip add 4.4.4.4 32

R5

[Huawei]sysname R5
[R5]interface g0/0/0
[R5-GigabitEthernet0/0/0]ip add 35.1.1.5 24
[R5-GigabitEthernet0/0/0]interface LoopBack0
[R5-LoopBack0]ip add 5.5.5.5 32

4.2 Configuring OSPF

R1

R1
[R1]router id 1.1.1.1
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]interface g0/0/0
[R1-GigabitEthernet0/0/0]ospf enable 1 area 0
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ospf enable 1 area 0
[R1-GigabitEthernet0/0/1]ospf cost 10 //Prevent load
[R1-GigabitEthernet0/0/1]interface LoopBack0
[R1-LoopBack0]ospf enable 1 area 0

R2

[R2]router id 2.2.2.2
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]interface g0/0/0
[R2-GigabitEthernet0/0/0]ospf enable 1 area 0
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ospf enable 1 area 0
[R2-GigabitEthernet0/0/1]interface LoopBack0
[R2-LoopBack0]ospf enable 1 area 0

R3

[R3]router id 3.3.3.3
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]interface g0/0/0
[R3-GigabitEthernet0/0/0]ospf enable 1 area 0
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ospf enable 1 area 0
[R3-GigabitEthernet0/0/1]interface LoopBack0
[R3-LoopBack0]ospf enable 1 area 0

R4

[R4]router id 4.4.4.4
[R4]ospf 1
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]interface g0/0/0
[R4-GigabitEthernet0/0/0]ospf enable 1 area 0
[R4-GigabitEthernet0/0/0]interface g0/0/1
[R4-GigabitEthernet0/0/1]ospf enable 1 area 0
[R4-GigabitEthernet0/0/1]interface LoopBack0
[R4-LoopBack0]ospf enable 1 area 0

4.3 Configuring BGP

R1

[R1]bgp 100
[R1-bgp]peer 2.2.2.2 as-number 100
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack0
[R1-bgp]peer 2.2.2.2 next-hop-local
[R1-bgp]peer 3.3.3.3 as-number 100
[R1-bgp]peer 3.3.3.3 connect-interface LoopBack0
[R1-bgp]peer 3.3.3.3 next-hop-local
[R1-bgp]peer 4.4.4.4 as-number 100
[R1-bgp]peer 4.4.4.4 connect-interface LoopBack0
[R1-bgp]peer 4.4.4.4 next-hop-local
[R1-bgp]network 1.1.1.1 32

R2

[R2]bgp 100
[R2-bgp]peer 1.1.1.1 as-number 100
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack0
[R2-bgp]peer 1.1.1.1 next-hop-local
[R2-bgp]peer 3.3.3.3 as-number 100
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack0
[R2-bgp]peer 3.3.3.3 next-hop-local
[R2-bgp]peer 4.4.4.4 as-number 100
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R2-bgp]network 2.2.2.2 32

R3

[R3]bgp 100
[R3-bgp]peer 1.1.1.1 as-number 100
[R3-bgp]peer 1.1.1.1 connect-interface LoopBack0
[R3-bgp]peer 1.1.1.1 next-hop-local
[R3-bgp]peer 2.2.2.2 as-number 100
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack0
[R3-bgp]peer 2.2.2.2 next-hop-local
[R3-bgp]peer 4.4.4.4 as-number 100
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack0
[R3-bgp]peer 4.4.4.4 next-hop-local
[R3-bgp]peer 35.1.1.5 as-number 200
[R3-bgp]network 3.3.3.3 32
[R3-bgp]network 1.1.1.1 32

R4

[R4]bgp 100
[R4-bgp]peer 1.1.1.1 as-number 100
[R4-bgp]peer 1.1.1.1 connect-interface LoopBack0
[R4-bgp]peer 1.1.1.1 next-hop-local
[R4-bgp]peer 2.2.2.2 as-number 100
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack0
[R4-bgp]peer 2.2.2.2 next-hop-local
[R4-bgp]peer 3.3.3.3 as-number 100
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack0
[R4-bgp]peer 3.3.3.3 next-hop-local
[R4-bgp]network 4.4.4.4 32

R5

[R5]bgp 200
[R5-bgp]peer 35.1.1.3 as-number 100
[R5-bgp]network 5.5.5.5 32

4.4 Configuring FRR

R1

[R1]ospf 1
[R1-ospf-1]frr
[R1-ospf-1-frr]loop-free-alternate

Before R1 configures FRR

After R1 is configured with FRR

  • Note: After R1 is configured with FRR, if R4 takes the R1-R2-R3-R5 path instead of the R3-R5 path, R1 will not have NexthopBak and OutIfBak.
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ospf cost 10


At this time, R4 goes to R3, and the NextHop is 14.1.1.1.


At this time, R1 will not have backup links, NexthopBak, and OutIfBak.

4.5 Configuring BFD

R1
[R1]bfd
[R1]ospf 1
[R1-ospf-1] bfd all-interfaces enable
[R1-ospf-1-frr]bfd all-interfaces min-tx-interval 20 min-rx-interval 20 detect-multiplier 3

R2
[R2]bfd
[R2]ospf 1
[R2-ospf-1] bfd all-interfaces enable
[R2-ospf-1-frr]bfd all-interfaces min-tx-interval 20 min-rx-interval 20 detect-multiplier 3


At this time, R2 is closed, and packet loss no longer occurs when R1 goes to R5.

4.6 Configuring Stub Router

R2
[R2]ospf 1
[R2-ospf-1]stub-router on-startup 120
  • Phenomenon: Before configuration, after closing R2, and then opening R2 and R2 completing OSPF negotiation, packet loss will occur for a long time. After R2’s BGP establishment is completed, packet loss will no longer occur.

  • Reason: OSPF establishment is completed, but BGP is not established. At this time, it switches to R2 and forwards through R2, and packet loss occurs.

  • Solution: After configuring the Stub router on R2, close R2 and then open R2 again. The link metric value of the LSA published by R2 is 65535, so it will not switch back to R2 and will still be forwarded through R4. Wait for 120s (BGP establishment is completed). , the link metric value recovers, and then switches back to R1. At this time, packet loss will no longer occur.

After OSPF is established, no more packets will be lost.

The link metric value of the LSA published by R2 is 65535.

The link metric value recovers after 120s.

5. Summary

  • After configuring FRR and BFD, packet loss still occurs when R2 is turned off?
    You need to enable BFD and FRR functions on both R1 and R2, instead of opening one R1 (especially R2, remember to save).
  • R1 cannot ping 5.5.5.5?
    R1 does not have a backhaul route and needs to announce 1.1.1.1 in R3’s BGP.
  • After R1 is configured with FRR, if R4 takes the R1-R2-R3-R5 path instead of the R3-R5 path, R1 will not have NexthopBak and OutIfBak.