当前位置:网站首页>2022-07-19 advanced network engineering (XX) BGP route optimization, route optimization analysis one by one

2022-07-19 advanced network engineering (XX) BGP route optimization, route optimization analysis one by one

2022-07-27 20:45:00 A goose

BGP Route optimization

When there are multiple routes to the same destination network segment ,BGP Route optimization is carried out in the following order

01 optimization Preferred-Value The attribute value is the largest The routing .

02 optimization Local_Preference The attribute value is the largest The routing .

03 Locally originated BGP Routing is better than the routing learned from other peers , Local origin priority : optimization Manual aggregation > Automatic aggregation >network>import> What we learned from the equivalent .

04 optimization AS_Path The attribute value is the shortest The routing .

05 optimization Origin Attribute optimal routing .Origin The attribute value ranges from The high to low arrangement is :IGP、EGP And Incomplete.

06 optimization MED The attribute value is the smallest The routing .

07 Preferably from EBGP Peer to peer routing (EBGP Routing priority is higher than IBGP route ).

08 optimization To Next_Hop Of IGP The smallest measure The routing .

09 optimization Cluster_List The shortest The routing .

10 optimization Router ID(Orginator_ID) Smallest equipment Advertised routing .

11 optimization Minimum IP Peer notification of address The routing .

The above rules are arranged in order ,BGP When routing optimization , Start with the first rule , If you cannot make a judgment according to the first rule , For example, routed Preferred-Value Same property value , Then continue to execute the next rule , If according to the current rules ,BGP Can decide the best route , No further execution . Be similar to ACL Matching rules .

BGP Route optimization is analyzed one by one

The topology

see BGP Detailed routing , You can check the reasons for not being preferred

<R7>display bgp routing-table 11.11.11.11

 BGP local router ID : 7.7.7.7
 Local AS number : 200
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 11.11.11.11/32:
 From: 5.5.5.5 (5.5.5.5)
 Route Duration: 00h06m10s  
 Relay IP Nexthop: 20.2.0.5
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 5.5.5.5
 Qos information : 0x0
 AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, bes
t, select, active, pre 255, IGP cost 1
 Not advertised to any peer yet

 BGP routing table entry information of 11.11.11.11/32:
 From: 6.6.6.6 (6.6.6.6)
 Route Duration: 00h06m25s  
 Relay IP Nexthop: 20.3.0.6
 Relay IP Out-Interface: GigabitEthernet0/0/1
 Original nexthop: 6.6.6.6
 Qos information : 0x0
 AS-path 100, origin igp, localpref 100, pref-val 0, valid, internal, pre 255, I
GP cost 1, not preferred for router ID
 Not advertised to any peer yet

analysis : among , The second route is indicated at the bottom “not preferred for router ID”, The reason why this route is not preferred is Router ID The larger .

multiple BGP Routing load balancing ( Affect this machine )

[R7-bgp]maximum load-balancing ibgp ?
  INTEGER<1-8>  Specify maximum equal cost routes

01 optimization Preferred-Value The attribute value is the largest The routing ( Unique attributes of Huawei equipment )

Modify attribute method :

1 Use preferred-value Command to change ( Modify on this machine , Routing optimization that affects itself )

[R7]bgp 200
[R7-bgp]peer 6.6.6.6 preferred-value 100

View modified results

<R7>display bgp routing-table 

 BGP Local router ID is 7.7.7.7 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 11
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  11.11.11.11/32     6.6.6.6                    100        100    100i
 * i                     5.5.5.5         0          100        0      100i
 *>i  22.22.22.22/32     6.6.6.6         0          100        100    100i
 * i                     5.5.5.5                    100        0      100i
 *>i  33.33.33.33/32     6.6.6.6                    100        100    100i
 * i                     5.5.5.5                    100        0      100i
 *>i  44.44.44.44/32     6.6.6.6                    100        100    100i
 * i                     5.5.5.5                    100        0      100i
 *>i  55.55.55.55/32     5.5.5.5         0          100        0      i
 *>i  66.66.66.66/32     6.6.6.6         0          100        100    i
 *>   77.77.77.77/32     0.0.0.0         0                     0      i

analysis :PrefVal Routes with large fields , Be preferred . modify preferred-value The feature of is that all the next hops are 6.6.6.6 All routes are optimized , Belong to right overall situation Make changes .

2 Use the routing policy to modify ( Modify on this machine , Routing optimization that affects itself )

[R7]acl 2000
[R7-acl-basic-2000]rule 5 permit source 11.11.11.11 0

[R7]route-policy 1 permit node 10
[R7-route-policy]if-match acl 2000
[R7-route-policy]apply preferred-value 200

[R7]bgp 200
[R7-bgp]peer 5.5.5.5 route-policy 1 import 

View modified results

<R7>display bgp routing-table 

 BGP Local router ID is 7.7.7.7 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 7
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  11.11.11.11/32     5.5.5.5         0          100        200    100i
 * i                     6.6.6.6                    100        100    100i
 *>i  22.22.22.22/32     6.6.6.6         0          100        100    100i
 *>i  33.33.33.33/32     6.6.6.6                    100        100    100i
 *>i  44.44.44.44/32     6.6.6.6                    100        100    100i
 *>i  66.66.66.66/32     6.6.6.6         0          100        100    i
 *>   77.77.77.77/32     0.0.0.0         0                     0      i

analysis : Adopt the method of policy routing to modify , You can modify a specified route entry , Relative to 1 Medium method , More accurate .

02 optimization Local_Preference The attribute value is the largest The routing .

The local priority attribute will be in AS Internal delivery , Will not be passed on to others AS. The default value 100.

Modify attribute method :

1 Modify the default local priority ( stay AS Inner boundary routing modifier , influence AS Other internal routers )

[R5]bgp 200
[R5-bgp]default local-preference 200

[R6]bgp 200
[R6-bgp]default local-preference 200

View modified results

<R7>dis bgp routing-table

 BGP Local router ID is 7.7.7.7 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 11
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  11.11.11.11/32     5.5.5.5         0          200        0      100i
 * i                     6.6.6.6                    200        0      100i
 *>i  22.22.22.22/32     5.5.5.5                    200        0      100i
 * i                     6.6.6.6         0          200        0      100i
 *>i  33.33.33.33/32     5.5.5.5                    200        0      100i
 * i                     6.6.6.6                    200        0      100i
 *>i  44.44.44.44/32     5.5.5.5                    200        0      100i
 * i                     6.6.6.6                    200        0      100i
 *>i  55.55.55.55/32     5.5.5.5         0          200        0      i
 *>i  66.66.66.66/32     6.6.6.6         0          200        0      i
 *>   77.77.77.77/32     0.0.0.0         0                     0      i

analysis : all LocPrf The field values change to 200, Belong to right overall situation Make changes .

2  Use the routing policy to modify ( stay AS Inner boundary routing modifier , influence AS Other internal routers )

[R5]acl 2000
[R5-acl-basic-2000]rule 5 permit source 11.11.11.11 0

[R5]route-policy 1 permit node 10
[R5-route-policy]if-match acl 2000
[R5-route-policy]apply local-preference 300
[R5]route-policy 1 permit node 20

[R5]bgp 200
[R5-bgp]peer 1.1.1.1 route-policy 1 import

View the modification results

<R7>display bgp routing-table

 BGP Local router ID is 7.7.7.7 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 10
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  11.11.11.11/32     5.5.5.5         0          300        0      100i
 *>i  22.22.22.22/32     5.5.5.5                    200        0      100i
 * i                     6.6.6.6         0          200        0      100i
 *>i  33.33.33.33/32     5.5.5.5                    200        0      100i
 * i                     6.6.6.6                    200        0      100i
 *>i  44.44.44.44/32     5.5.5.5                    200        0      100i
 * i                     6.6.6.6                    200        0      100i
 *>i  55.55.55.55/32     5.5.5.5         0          200        0      i
 *>i  66.66.66.66/32     6.6.6.6         0          200        0      i
 *>   77.77.77.77/32     0.0.0.0         0                     0      i

analysis : Adopt the method of policy routing to modify , You can modify a specified route entry , Relative to 1 Medium method , More accurate .

03 Locally originated BGP Routing is better than the routing learned from other peers , Local origin priority : optimization Manual aggregation > Automatic aggregation >network>import> What we learned from the equivalent

04 optimization AS_Path The attribute value is the shortest The routing

See

2022-07-15 Advanced network engineering ( nineteen )BGP- State machine 、 The principle of interaction between peers 、 Factors that affect the establishment of peer relationships 、 Peer surface 、 Routing table 、 Detailed routing table 、 Routing properties _ Goose blog -CSDN Blog

05 optimization Origin Attribute optimal routing .Origin The attribute value ranges from The high to low arrangement is :IGP、EGP And Incomplete

See

2022-07-15 Advanced network engineering ( nineteen )BGP- State machine 、 The principle of interaction between peers 、 Factors that affect the establishment of peer relationships 、 Peer surface 、 Routing table 、 Detailed routing table 、 Routing properties _ Goose blog -CSDN Blog

06 optimization MED The attribute value is the smallest The routing

MED(Multi-Exit Discriminator, Multiple exit discriminator ) Is an optional non transitional attribute , It's a measure , Used to point out to external peers that they have entered this AS Preferred path for , That is, when entering this AS There are multiple times at the entrance of ,AS have access to MED Dynamically affect others AS Choose the path to enter .

MED The smaller the attribute value is BGP The better the route is .

MED Mainly used in AS Influence between BGP The right way .MED Be passed on to EBGP After peer , Peer in its AS Internal delivery routing , Take with you MED value , But pass the route to it again EBGP Peer time , By default, it will not carry MED attribute .

characteristic :

MED At most, only two adjacent AS, received MED Attribute AS Will not pass it on to others AS.

MED Properties are similar to COST, It is applicable when a destination has multiple routes , And a AS When there are multiple entrances , Manually configurable MED Optimize the route .

Use the routing policy to modify ( stay AS Inner boundary routing modifier , influence AS Other routers in -export, Influence oneself -import)

[R5]acl 2000
[R5-acl-basic-2000]rule 5 permit source 11.11.11.11 0 

[R5]route-policy 1 permit node 10
[R5-route-policy]if-match acl 2000
[R5-route-policy]apply cost 20

[R5]bgp 200
[R5-bgp]peer 1.1.1.1 route-policy 1 import
[R5-bgp]compare-different-as-med
[R5-bgp]bestroute med-none-as-maximum

PS:

compare-different-as-med command . By default , Routers only compare from the same neighbor AS Of BGP The routing MED value , You can use this command to start from different AS The same route is also compared MED value .

bestroute med-none-as-maximum command . To configure BGP When selecting the best route , If there is no MED Value is treated as the maximum .

View the modification results

[R5]display bgp routing-table 

 BGP Local router ID is 5.5.5.5 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 11
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   11.11.11.11/32     1.1.1.1         100                   0      100i
 * i                     6.6.6.6                    100        0      100i
 *>i  22.22.22.22/32     6.6.6.6         0          100        0      100i
 *                       1.1.1.1                               0      100i
 *>   33.33.33.33/32     1.1.1.1                               0      100i
 * i                     6.6.6.6                    100        0      100i
 *>   44.44.44.44/32     1.1.1.1                               0      100i
 * i                     6.6.6.6                    100        0      100i
 *>   55.55.55.55/32     0.0.0.0         0                     0      i
 *>i  66.66.66.66/32     6.6.6.6         0          100        0      i
 *>i  77.77.77.77/32     7.7.7.7         0          100        0      i

analysis : Go to 11.11.11.11 Because of the next hop 1.1.1.1 The routing MED Change the value to 100, But because of the configuration bestroute med-none-as-maximum command , So go 11.11.11.11 and 22.22.22.22 Routing of ,MED The route in case of loss is the maximum , Are not preferred .

07 Preferably from EBGP Peer to peer routing (EBGP Routing priority is higher than IBGP route

If you arrive at a destination with 2 Different routes , One from IBGP Learning to , One from EBGP Learning to , Will be preferred EBGP Learned this .

08 optimization To Next_Hop Of IGP The smallest measure The routing

Refers to the bottom IGP The cost value of the protocol , for example OSPF、IS-IS

See

2022-04-09 Advanced network engineering ( 3、 ... and )OSPF- measurements 、 Three major table items 、 neighbor _ Goose blog -CSDN Blog

2022-06-27 Advanced network engineering ( Twelve )IS-IS- Cost type 、 Cost calculation 、LSP Processing mechanism 、 Route revocation 、 Route penetration _ Goose blog -CSDN Blog _ Routing computation overhead

09 optimization Cluster_List The shortest The routing

Relevant command

Configure the reflector

[R7-bgp]peer 6.6.6.6 reflect-client 

10 optimization Router ID(Orginator_ID) Smallest equipment Advertised routing

11 optimization Minimum IP Peer notification of address The routing

Refers to the size of the updated source address

原网站

版权声明
本文为[A goose]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/208/202207271801340373.html