菱形組網之BGP篇

菱形組網之BGP MED、負載分擔及GR篇-1323877-1

BGP選路規則

1.     MEDRouterID<)和負載分擔

到達同一目的地的多條路由,選擇最優路由,下發到IP路由表

PE1查看路由表

[PE1]dis ip routing-table                                                      

Route Flags: R - relay, D - download to fib                                    

------------------------------------------------------------------------------ 

Routing Tables: Public                                                         

         Destinations : 22       Routes : 22                                   

                                                                                

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface     

                                                          

4.4.4.4/32        EBGP    255   0        D   100.1.3.2     GigabitEthernet0/2/2 

可以

可以看到PE4loopback0路由選擇的是PE3爲下一跳

繼續查看詳細原因

[PE1]dis bgp routing-table 4.4.4.4 32                                           

                                                                               

 BGP local router ID : 1.1.1.1                                                 

 Local AS number : 200                                                          

 Paths:   2 available, 1 best, 1 select                                        

 BGP routing table entry information of 4.4.4.4/32:                            

 From: 100.1.3.2 (3.3.3.3)                                                      

 Route Duration: 00h19m35s                                                     

 Direct Out-interface: GigabitEthernet0/2/2                                    

 Original nexthop: 100.1.3.2                                                   

 Qos information : 0x0                                                         

 AS-path 100, origin incomplete, pref-val 0, valid, external, best, select, acti

ve, pre 255                                                                    

 Advertised to such 2 peers:                                                   

    100.1.3.2                                                                  

    100.1.2.2                                                                  

 BGP routing table entry information of 4.4.4.4/32:                            

 From: 100.1.2.2 (2.2.2.2)                                                     

 Route Duration: 00h17m34s                                                     

 Direct Out-interface: GigabitEthernet0/2/5                                    

 Original nexthop: 100.1.2.2                                                   

 Qos information : 0x0                                                         

 AS-path 100, origin incomplete, MED 1, pref-val 0, valid, external, pre 255, no

t preferred for MED                                                             

 Not advertised to any peer yet  

 

MEDMulti-exit Discriminator),多出口辨別符,主要就是給來自AS外的兩個目的IP相同,下一跳不同的路由選擇用,本例中,PE2PE3都給了PE1 4.4.4.4路由,但是爲啥沒有選擇PE3的?可以看看PE1BGP路由表,選擇MED值小的。

[PE1]dis bgp routing-table                                                     

                                                                                

 BGP Local router ID is 1.1.1.1                                                

 Status codes: * - valid, > - best, d - damped,                                

               h - history,  i - internal, s - suppressed, S - Stale           

               Origin : i - IGP, e - EGP, ? - incomplete                       

                                                                               

                                                                                

 Total Number of Routes: 12                                                    

      Network            NextHop        MED    LocPrf    PrefVal Path/Ogn  

     

 *>   4.4.4.4/32         100.1.3.2                            0      100?     

 *                      100.1.2.2       1                   0      100?

 

路由器ID

    PE2上發佈100.2.3.0路由

    PE1上看到

[PE1]dis bgp routing-table 100.2.3.0                                           

                                                                                

 BGP local router ID : 1.1.1.1                                                 

 Local AS number : 200                                                         

 Paths:   2 available, 1 best, 1 select                                        

 BGP routing table entry information of 100.2.3.0/24:                          

 From: 100.1.2.2 (2.2.2.2)                                                     

 Route Duration: 00h06m07s                                                     

 Direct Out-interface: GigabitEthernet0/2/5                                    

 Original nexthop: 100.1.2.2                                                   

 Qos information : 0x0                                                         

 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, best, select, acti

ve, pre 255                                                                    

 Advertised to such 2 peers:                                                   

    100.1.3.2                                                                   

    100.1.2.2                                                                  

 BGP routing table entry information of 100.2.3.0/24:                          

 From: 100.1.3.2 (3.3.3.3)                                                      

 Route Duration: 00h02m05s                                                     

 Direct Out-interface: GigabitEthernet0/2/2                                    

 Original nexthop: 100.1.3.2                                                    

 Qos information : 0x0                                                         

 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, pre 255, not prefe

rred for router ID                                                              

 Not advertised to any peer yet   

    11條,路由器ID小的被選中。

    看紅色字體部分,選中了一條路由,如果想要選中兩條路由做負載分擔,可以在PE1配置

maximum load-balancing ebgp 2

 

[PE1]dis bgp routing-table 100.2.3.0                                           

                                                                               

 BGP local router ID : 1.1.1.1                                                 

 Local AS number : 200                                                         

 Paths:   2 available, 1 best, 2 select

 

如果想讓PE3的被選中

可以在PE3bgp進程裏應用路由策略,路由策略

route-policy med permit node 10                                                

 apply cost 99   (該值是MED值)

peer 100.1.3.1 route-policy med export  

reset BGP進程

然後在PE1上看效果

BGP routing table entry information of 100.2.3.0/24:                          

 From: 100.1.3.2 (3.3.3.3)                                                     

 Route Duration: 00h00m23s                                                      

 Direct Out-interface: GigabitEthernet0/2/2                                    

 Original nexthop: 100.1.3.2                                                   

 Qos information : 0x0                                                         

 AS-path 100, origin igp, MED 99, pref-val 0, valid, external, pre 255, not pref

erred for MED                                                                  

 Not advertised to any peer yet 

 

2.       BGP GR

沒使能GR之前,在PE2 reset bgp進程

  --- 100.2.3.1 ping statistics ---                                            

    143 packet(s) transmitted                                                  

    127 packet(s) received                                                      

    11.18% packet loss                                                         

round-trip min/avg/max = 1/1/1 ms  

PE1上會出現丟包

前面OSPFv3已經說過,此處不再重複。一個restarter一個helper


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章