zoukankan      html  css  js  c++  java
  • Lab Block hole of BGP

    Lab Block hole


    Platform:cisco iou

    什么是路由黑洞? 简单的说,它会默默的将数据包丢弃,使所有数据包有去无回。
    我们通过下面的一些例子来了解路由黑洞。
    说明:在R1,R2,R3之间运行OSPF;
          在R4和R1之间运行EBGP;
          在R3和R5之间运行EBGP;
          在R1和R3之间运行IBGP。

        当R1从AS4学习到一条到4.4.4.4/32的路由,然后通过IBGP连接把它宣告给R3,R3通过next-hop-self策略将next-hop改成自己的路由器ID,然后将该路由宣告给AS5。于是,AS5中的路由器开始转发4.4.4.4/32的路由给R3。R3执行一个到4.4.4.4/32的路由查找,并了解到是通过R1可以达到该网络。于是又查找R1的IP地址,通过查找了解到可以通过R2到达。但是外部路由是通过IBGP由R1和R3共享的。OSPF无法了解到外部路由。因为,当数据包被转发给R2以后,路由器进行路由查找但是没有找到4.4.4.4/32的路由。就会丢弃所有往该地址的数据包,到网络4.4.4.4/32的数据流量就形成了黑洞。


    方案一:在R1上将BGP里的4.4.4.4/32重分发到IGP里;在R3上将BGP里的5.5.5.5/32重分发到IGP里。这样做的原因是让R2的路由表也学到了4.4.4.4/32和5.5.5.5/32,当数据包到R2时,查找路由表,寻找相应的下一跳。

    Step 1、Bridge

    Step 2、R1,R2,R3 (IGP)

    Step 3、R1,R4之间运行EBGP。R3,R5之间运行EBGP。通告: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、在R1和R3分别将4.4.4.4/32和5.5.5.5/32重分发到IGP里。
    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、测试成功。

    方案二:关闭同步采用全网状IBGP连接,可以AS内防止BGP路由环路并且保证BGP路由上的所有路由器都知道如何将数据包转发到目的地。
    同步:一条从IBGP邻居学习到的路由在进入IGP路由表或者宣告给一个BGP对端之前,通过IGP必须知道该路由。

    关闭同步的好处:
    设置同步的话,需要你的AS内的IGP有BGP的路由,这样会极大的增加路由器的负担。而且不会出现路由黑洞的情况。

    Step 1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。

    Step 2、R1,R2,R3之间运行OSPF,并通告环回口,使R1,R2,R3都能互相学习。并使用ping测试是否已学习路由。

    Step 3、R1,R4之间运行EBGP。R3,R5之间运行EBGP。通告: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、完成,在R4使用命令进行测试 ping 5.5.5.5 source 4.4.4.4


    结论:解决路由黑洞的方法不仅仅以上的两种方案,如使用静态路由、反射器等等。


     

  • 相关阅读:
    Spring boot unable to determine jdbc url from datasouce
    Unable to create initial connections of pool. spring boot mysql
    spring boot MySQL Public Key Retrieval is not allowed
    spring boot no identifier specified for entity
    Establishing SSL connection without server's identity verification is not recommended
    eclipse unable to start within 45 seconds
    Oracle 数据库,远程访问 ora-12541:TNS:无监听程序
    macOS 下安装tomcat
    在macOS 上添加 JAVA_HOME 环境变量
    Maven2: Missing artifact but jars are in place
  • 原文地址:https://www.cnblogs.com/cyrusxx/p/12824231.html
Copyright © 2011-2022 走看看