Lab Block hole of BGP

Lab Block hole


Platform: cisco iou

What is a routing black hole? Simply put, it will silently discard the data packets, so that all data packets are gone.
We use some examples below to understand routing black holes.
Note: OSPF runs between R1, R2, and R3;
      EBGP runs between R4 and R1; EBGP runs between
      R3 and R5;
      and IBGP runs between R1 and R3.

    When R1 learns a route to 4.4.4.4/32 from AS4, and then announces it to R3 through an IBGP connection, R3 changes the next-hop to its router ID through the next-hop-self policy, and then announces the route Give AS5. Therefore, the router in AS5 starts to forward the 4.4.4.4/32 route to R3. R3 performs a route lookup to 4.4.4.4/32 and learns that the network can be reached via R1. So I searched R1's IP address again, and I found that I could reach it through R2. However, external routes are shared by R1 and R3 through IBGP. OSPF cannot learn about external routes. Because, after the data packet is forwarded to R2, the router performs route lookup but does not find the route of 4.4.4.4/32. All data packets to this address will be discarded, and the data traffic to the network 4.4.4.4/32 will form a black hole.


Option 1: Redistribute 4.4.4.4/32 in BGP to IGP on R1; redistribute 5.5.5.5/32 in BGP to IGP on R3. The reason for this is to let R2's routing table also learn 4.4.4.4/32 and 5.5.5.5/32. When the packet arrives at R2, it looks up the routing table and finds the corresponding next hop.

Step 1、Bridge

Step 2、R1,R2,R3 (IGP)

Step 3. Run EBGP between R1 and R4. EBGP runs between R3 and R5. Notice: 4.4.4.4/32, 5.5.5.5/32.
R1:
router bgp 123
 no synchronization
 neighbor 14.1.1.4 remote-as 4
 no auto-summary

R3:
router bgp 123
 no synchronization
 neighbor 35.1.1.5 remote-as 5
 no auto-summary 

R4:
router bgp 4
 no synchronization
 network 4.4.4.4 mask 255.255.255.255
 neighbor 14.1.1.1 remote-as 123
 no auto-summary

R5:
router bgp 5
 no synchronization
 network 5.5.5.5 mask 255.255.255.255
 neighbor 35.1.1.3 remote-as 123
 no auto-summary

Step 4、R1,R3之间建立IBGP连接。
R1:
router bgp 123
 no synchronization
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 no auto-summary

R3:
router bgp 123
 no synchronization
 neighbor 1.1.1.1 remote-as 123
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 next-hop-self
 no auto-summary

Step 5. Redistribute 4.4.4.4/32 and 5.5.5.5/32 to IGP on R1 and R3 respectively.
R1:
router ospf 100
 redistribute bgp 123 subnets route-map ccnp

ip prefix-list ccna seq 5 permit 4.4.4.4/32
route-map ccnp permit 10
 match ip address prefix-list ccna

R3:
ip prefix-list ccna seq 5 permit 5.5.5.5/32
route-map ccnp permit 10
 match ip address prefix-list ccna

router ospf 100
 redistribute bgp 123 subnets route-map ccnp

Step 6. The test is successful.

Option 2: Turn off synchronization and use a full mesh IBGP connection to prevent BGP routing loops in the AS and ensure that all routers on the BGP route know how to forward packets to their destination.
Synchronization: Before a route learned from an IBGP neighbor enters the IGP routing table or is announced to a BGP peer, it must know the route through the IGP.

The benefits of turning off synchronization: If you
set up synchronization, you need the IGP in your AS to have BGP routes, which will greatly increase the burden on the router. And there will be no routing black holes.

Step 1. Configure the IP address of each router, and use the Ping command to confirm the interoperability of the direct connection ports of each router.

Step 2. Run OSPF between R1, R2, and R3, and notify the loopback port so that R1, R2, and R3 can learn from each other. And use ping to test whether the route has been learned.

Step 3. Run EBGP between R1 and R4. EBGP runs between R3 and R5. Notice: 4.4.4.4/32, 5.5.5.5/32.

Step 4、R1,R2,R3之间建立全互连的IBGP连接。
R1:
router bgp 123
 no synchronization
 neighbor 2.2.2.2 remote-as 123
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 no auto-summary

R2:
router bgp 123
 no synchronization
 network 2.2.2.2 mask 255.255.255.255
 neighbor 1.1.1.1 remote-as 123
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 next-hop-self
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 no auto-summary

R3:
router bgp 123
 no synchronization
 neighbor 1.1.1.1 remote-as 123
 neighbor 1.1.1.1 update-source Loopback0
 neighbor 1.1.1.1 next-hop-self
 neighbor 2.2.2.2 remote-as 123
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 2.2.2.2 next-hop-self
 no auto-summary

Step 5. Done, use command to test in R4 ping 5.5.5.5 source 4.4.4.4


Conclusion: The solution to the routing black hole is not only the above two solutions, such as the use of static routing, reflectors and so on.


 

Published 220 original articles · won praise 2 · Views 4463

Guess you like

Origin blog.csdn.net/qq_43207781/article/details/105480910
BGP