【理论准备】


几个概念:

反射器RR:在路由器上配置了反射器命令的路由器就是反射器RR

客户机:所有的客户机与反射器建立了IBGP连接,但是客户机并不知道自己是客户机,比如在分级反射器中,二级的反射器也是一级的客户机。

集群:路由器反射器和它的客户机一起组成的组

非客户机:既不是反射器也不是客户机的路由器

非客户机与RR,以及非客户机之间必须建立全连接


RR收到IBGP发来的路由时,首先使用BGP选择路由的策略选最佳路由,在公布学到的路由时,RR按照RFC2796中的规则来发布路由

1、从非客户机对等体学到的路由 ,发布给引RR的所有的客户机

2、从客户机学到的路由,发布给引RR的所有非客户机和客户机

3、从EBGP对等体学到的路由,发布给所有的客户机和非客户机

【组网拓扑】



R5、R1、R2、R4之间如下方式连接起来,各接口ip如图所示



 



bgp 集群反射器 bgp路由反射器_Mask



 



本文实验采用的交换机是H3C模拟器,下载地址如下:http://forum.h3c.com/forum.php?mod=viewthread&tid=109740&highlight=H3C%E6%A8%A1%E6%8B%9F%E5%99%A8



有兴趣的朋友可以在论坛上去下载。 



 



【配置步骤】



先将接口IP(略)



 



【BGP的相关配置】



R5:



bgp 100
 
    
 network 10.1.1.1 255.255.255.255
 
    
 undo synchronization
 
    
 peer 10.1.2.2 as-number 200
 
    
 group in internal
 
    
 group ex external
 
    
 peer 10.1.2.2 group ex



 



 



R1:



bgp 200 
     
 
     

        undo synchronization 
     
 
     

        peer 10.1.2.1 as-number 100 
     
 
     

        group in internal 
     
 
     

        peer 10.1.3.2 group in 
     
 
     

        group ex external 
     
 
     

        peer 10.1.2.1 group ex



R2:



bgp 200 
     
 
     

        undo synchronization 
     
 
     

        group in internal 
     
 
     

        peer 10.1.3.1 group in 
     
 
     

        peer 10.1.4.2 group in 
     
 
     

         
     
 
     

       #



R4:



bgp 200 
     
 
     

        undo synchronization 
     
 
     

        group in internal 
     
 
     

        peer 10.1.4.1 group in



 









【实验步骤】



1、配置完成后请看路由表:



<R5>dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 6        Routes : 6
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.2.0/24         Direct 0    0            10.1.2.1        S0/6/3
 
     
10.1.2.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.2.2/32         Direct 0    0            10.1.2.2        S0/6/3
 
     
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
 
     

 
     
[R2]dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 8        Routes : 8
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.3.0/24         Direct 0    0            10.1.3.2        S0/6/0
 
     
10.1.3.1/32         Direct 0    0            10.1.3.1        S0/6/0
 
     
10.1.3.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.4.0/24         Direct 0    0            10.1.4.1        S0/6/1
 
     
10.1.4.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.4.2/32         Direct 0    0            10.1.4.2        S0/6/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
 
     

 
     
[R4-bgp]dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 6        Routes : 6
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.4.0/24         Direct 0    0            10.1.4.2        S0/6/1
 
     
10.1.4.1/32         Direct 0    0            10.1.4.1        S0/6/1
 
     
10.1.4.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.5.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
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
 
     

 
     
[R1-bgp]dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 9        Routes : 9
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.1.1/32         BGP    255  0            10.1.2.1        S0/6/3
 
     
10.1.2.0/24         Direct 0    0            10.1.2.2        S0/6/3
 
     
10.1.2.1/32         Direct 0    0            10.1.2.1        S0/6/3
 
     
10.1.2.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.3.0/24         Direct 0    0            10.1.3.1        S0/6/0
 
     
10.1.3.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.3.2/32         Direct 0    0            10.1.3.2        S0/6/0
 
     
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






从四张路由表中可知,只有R1学到了R5上10.1.1.1的路由。






2、next-hop-local 命令应用分析:






[R2]
 
     
[R2]dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 8        Routes : 8
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.3.0/24         Direct 0    0            10.1.3.2        S0/6/0
 
     
10.1.3.1/32         Direct 0    0            10.1.3.1        S0/6/0
 
     
10.1.3.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.4.0/24         Direct 0    0            10.1.4.1        S0/6/1
 
     
10.1.4.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.4.2/32         Direct 0    0            10.1.4.2        S0/6/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



路由表中没有






<R2>dis bgp ro
 
     

 
     
 Total Number of Routes: 1
 
     

 
     
 BGP Local router ID is 10.1.4.1 
 
     
 Status codes: * - valid, > - best, d - damped,
 
     
               h - history,  i - internal, s - suppressed, S - Stale
 
     
               Origin : i - IGP, e - EGP, ? - incomplete
 
     
     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
 
     

 
     
   i 10.1.1.1/32        10.1.2.1        0          100        0       100i



BGP路由表中有,但是不是最佳的,没有写入路由表






[R1-bgp]peer 10.1.3.2 next-hop-local
  
     
[R2]dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 9        Routes : 9
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.1.1/32         BGP    255  0            10.1.3.1        S0/6/0
 
     
10.1.3.0/24         Direct 0    0            10.1.3.2        S0/6/0
 
     
10.1.3.1/32         Direct 0    0            10.1.3.1        S0/6/0
 
     
10.1.3.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.4.0/24         Direct 0    0            10.1.4.1        S0/6/1
 
     
10.1.4.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.4.2/32         Direct 0    0            10.1.4.2        S0/6/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
 
     

 
     
[R2]dis bgp ro
 
     

 
     
 Total Number of Routes: 1
 
     

 
     
 BGP Local router ID is 10.1.4.1 
 
     
 Status codes: * - valid, > - best, d - damped,
 
     
               h - history,  i - internal, s - suppressed, S - Stale
 
     
               Origin : i - IGP, e - EGP, ? - incomplete
 
     
     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
 
     

 
     
 *>i 10.1.1.1/32        10.1.3.1        0          100        0       100i



路由表中有,并且是最佳合法的。






[R2]






在R1上没有配置next-hop-local时,R2无路由,R1上配置了next-hop-local后,R2上有路由,缺省情况下,向EBGP对等体/对等体组发布路由时,将自身地址作为下一跳;向IBGP对






等体/对等体组发布路由时,不将自身地址作为下一跳。









3、配置反射器






配置前我们来看R4的情况



<R4>dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 6        Routes : 6
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.4.0/24         Direct 0    0            10.1.4.2        S0/6/1
 
     
10.1.4.1/32         Direct 0    0            10.1.4.1        S0/6/1
 
     
10.1.4.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.5.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
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
 
     

 
     
<R4>
 
     
<R4>
 
     
<R4>dis bgp ro
 
     

 
     
 Total Number of Routes: 0
 
     
<R4>






将R2作为反射器,因为只有他与区域内的其他路由器建立了全连接



bgp 200视图下加入如下命令:



peer 10.1.3.1 reflect-client 
 
     
peer 10.1.4.2 reflect-client









配置完成后我们来看R4的情况






<R4>dis ip ro
 
     
Routing Tables: Public
 
     
        Destinations : 6        Routes : 6
 
     

 
     
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
 
     

 
     
10.1.4.0/24         Direct 0    0            10.1.4.2        S0/6/1
 
     
10.1.4.1/32         Direct 0    0            10.1.4.1        S0/6/1
 
     
10.1.4.2/32         Direct 0    0            127.0.0.1       InLoop0
 
     
10.1.5.1/32         Direct 0    0            127.0.0.1       InLoop0
 
     
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
 
     

 
     
<R4>dis bgp ro
 
     

 
     
 Total Number of Routes: 1
 
     

 
     
 BGP Local router ID is 10.1.5.1 
 
     
 Status codes: * - valid, > - best, d - damped,
 
     
               h - history,  i - internal, s - suppressed, S - Stale
 
     
               Origin : i - IGP, e - EGP, ? - incomplete
 
     
     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
 
     

 
     
   i 10.1.1.1/32        10.1.3.1        0          100        0       100i






配置完成后学到了10.1.1.1的路由!



 


转载于:https://blog.51cto.com/hciewd/1130974