详解BGP 双平面

版权声明:HUGO https://blog.csdn.net/weixin_42078367/article/details/84678846

  

拓扑描述:上平面为A 面(AS1),下平面为B 面 (AS2) , 左边用户群(AS3),右边用户群(AS4)

                      组成两个平面的原因:两个城市之间的数据交互,分为业务流量和办公流量,于此同时 希望业务流量走 上面,办公流量走下面。流量的组成会很清晰,同时两个平面 互相为对方的备份平面,并且为对方减轻负担。

要求:

R9-XA路由器两个环回10.100.1.1/24和10.200.1.1/24

R10-DG路由器两个环回10.100.2.1/24和10.200.2.1/24

10.100.1.1---为业务流量 流过AS1(A平面)

10.100.2.1---为办公流量流过AS2(B平面)

10.200.1.1----为业务流量 流过AS1(A平面)

10.200.2.1----为办公流量流过AS2(B平面)

当R9-->R1的链路发生问题,R10-->R5链路未发生问题 。R9是会自动的切换到B面,但是在R8( 即CD-B)上 ,会优选来自A 平面

实验方法及配置:

1.配置IP地址--这些为基础配置,暂时不在这里赘述。

2.AS内部配置IGP(AS1配置了OSPF、AS2配置了EIGR)

  a. 以R1 为例,R3 R5 R7 均是类似配置

            R1(config)#router ospf 1

           R1(config-router)#router-id 1.1.1.1

           R1(config-router)#network 10.1.0.0 0.0.255.255 area 0

           R1(config-router)#network 10.1.1.1 0.0.0.0 area 0   

 b. 以R2为例, R4 ,R6,R8均是类似配置

          R2(config)#router eigrp 90     

          R2(config-router)#no auto-summary

          R2(config-router)#network 10.1.0.0 0.0.255.255

          R2(config-router)#network 10.2.2.2  0.0.0.0  

c.所有路由器配置BGP,分别建立ebgp邻居 和ibgp邻居

以R1 为例,其余路由器配置类似

         R1(config)#router bgp 1

         R1(config-router)#bgp router-id 1.1.1.1

         R1(config-router)#neighbor 10.99.1.2 remote-as  3

         R1(config-router)#neighbor 10.99.1.2 send-community both

 

         R1(config-router)#neighbor 10.1.12.2 remote-as  2

        R1(config-router)#neighbor 10.1.12.2 send-community both

 

 

       R1(config-router)#neighbor  kkk peer-group

        R1(config-router)#neighbor  kkk  update-source loopback 0

       R1(config-router)#neighbor  kkk  remote-as 1

       R1(config-router)#neighbor  kkk  next-hop-self

       R1(config-router)#neighbor  kkk  send-community both

       R1(config-router)#neighbor 10.3.3.3 peer-group kkk

       R1(config-router)#neighbor 10.5.5.5 peer-group kkk

        R1(config-router)#neighbor 10.7.7.7 peer-group kkk

        由于建立IBGP邻居的数量稍微有点多,因此采用 peer-group  来建邻,可以减少一定量的配置

 

建立完邻居后,

以R1的邻居关系为例

 

 4.R9-XA和R10-DG将路由分别 加上社团属性在BGP中发送,这样打上标记的路由有利于捕捉路由。

 a.分别抓取路由,进行分类。

R9(config)#ip prefix-list YW PERmit  10.100.1.0/24

R9(config)#ip prefix-list BG PERmit  10.100.2.0/24

b.对分类的路由进行打上标签

R9(config)#route-map COMMU permit 10

R9(config-route-map)#match ip address prefix-list  YW

R9(config-route-map)#SET COMmUnity 1:10

R9(config-route-map)#EXIT

 

R9(config)#ROUTE-map COMMU PERmit 20

R9(config-route-map)#MATch IP ADDress  PREfix-list BG

R9(config-route-map)#set community 2:10

R9(config-route-map)#EXIT

c.在bgp上调用

R9(config)#router bgp 3

R9(config-router)#neighbor 10.99.1.1 route-map COMMU OUT

R9(config-router)#neighbor 10.99.2.1 route-map COMMU OUT

 

d.进行查看

R1(config)#ip bgp-community new-format -------可以将标签转化为1:10 的形式,建议每个路由都统一敲一下,方便查看标记。

 

 同理在R10-DG上的配置:

         a.分别抓取路由,进行分类。

          R10(config)#ip prefix-list YW PERmit  10.200.1.0/24

         R10(config)#ip prefix-list BG PERmit  10.200.2.0/24

       b.对分类的路由进行打上标签

          R10(config)#route-map COMMU permit 10

         R10(config-route-map)#match IP ADDress PREfix-list  YW

         R10(config-route-map)#set COMMUnity 1:20

         R10(config-route-map)#EXIT

          R10(config)#ROUTER-MAP COMMU PER 20

          R10(config-route-map)#MATch IP ADdress PREfix-list  BG

          R10(config-route-map)#SET COMMUnity 2:20

          R10(config-route-map)#EXIT

       c.在bgp上调用

         R10(config)#ROUTER BGP 4

        R10(config-router)#NEIghbor 10.99.3.1 ROUTE-MAP COMMU  OUT

        R10(config-router)#NEIghbor 10.99.4.1 ROUTE-MAP COMMU  OUT

 

 

5.R9-XA和R10-DG利用团体列表匹配社团属性为1:和2:的路由修改weight值在BGP中调用,实现业务路由(1:x)走上面,办公路由(2:x)走下面

         a.用团体列表 抓取 标签路由

         R9(config)#ip community-list expanded A permit ^1:*

         R9(config)#ip community-list expanded B permit ^2:*

         b.用route-map 修改weight值

         R9(config)#route-map A PERmit 10
         R9(config-route-map)#MATch COMmunity A
         R9(config-route-map)#Set  WEIght 100

         R9(config-route-map)#EXIT


          R9(config)#route-map A PERmit 20

          R9(config-route-map)#EXIT

          R9(config)#route-map B permit 10
          R9(config-route-map)#match community B

         R9(config-route-map)#SET weight 100

          R9(config-route-map)#exit


          R9(config)#route-map  B PERmit 20

          R9(config-route-map)#EXIT

 

        c.在bgp里调用

          R9(config)#router bgp 3

          R9(config-router)#neighbor 10.99.1.1 route-map A IN

           R9(config-router)#neighbor 10.99.2.1 route-map B IN

 

 R10是类似的配置  

初步效果路径图:

6.当 R9-XA 到 R1-BJ-A的链路发生问题时,可以来调节weight属性,只要来自A面的weight属性高与 来自B平面的就可以做到,R8-CD-B会优选 来自A平面。

      R8(config)#ip community-list expanded COM-A permit ^1:*

 

      R8(config)#route-map COM-A PERmit 10

      R8(config-route-map)#MATch COMmunity  COM-A

      R8(config-route-map)#SET WEIght 100

       R8(config-route-map)# EXIT

       R8(config)#ROUTE-map COM-A PERmit 20

        R8(config-route-map)#EXIT

 

        R8(config)#router bgp 2

        R8(config-router)#neighbor 10.1.78.1 route-map  COM-A IN

 

这些以上配置 在 R2  R4 R6 上敲,让B面成A面 的备份面

以下配置 在  R1 R3 R5上敲,让A面成B面 的备份面

R7(config)#ip community-list expanded COM-B PERmit ^2:*

R7(config)#route-map COM-BPER 10

R7(config-route-map)#match community  COM-B

R7(config-route-map)#SET Weigh 100

R7(config-route-map)#EXIT

R7(config)#route-map COMA PERmit 20

R7(config-route-map)#EXIT

 

R7(config)#ROUTER BGP 1

R7(config-router)#neighbor 10.1.78.2 route-map COM-A IN

 

 

 

 

8.针对于R1 与  R2 R3 之间的问题:当R10的路由传给 R4,然后分别传给 R3 跟 R2,此时R3 以ibgp邻居身份们再次传给 R1.  R2 以ebgp邻居身份传给R1,根据bgp的选路原则,EBGP>IBGP ,就会与我设计初衷相违背,于是需要进行调整。其他类似问题(R5 与  R7 , R6)均可用下列方法解决     ( R1, R5,  R4, R8均会出现类似问题 )

解决方法:只要让R1更加信任 来自A面即可,把来自R3的路由 weight属性 调大即可

R1(config)#ip community-list expanded A permit ^1:*

 

R1(config)# route-map COM-A PERmit 10 

R1(config-route-map)#MATch COMmunity A

R1(config-route-map)#set wei

R1(config-route-map)#set weight 100

R1(config-route-map)#exit

 

R1(config)#route-map COM-A PERmit 20

R1(config-route-map)#exit

 

R1(config)#router bgp 1

R1(config-router)#neighbor kkk route-map COM-A IN

又上图可知。当R10-->R5的链路出现问题时,路径图显示走法,与我们设想一致。因此以上的配置是可行的!!!!!!!!!!!!

猜你喜欢

转载自blog.csdn.net/weixin_42078367/article/details/84678846
BGP
今日推荐