BGP path attributes

Path attributes
1. Definition:
path attributes: path attributes, similar to metric, used to measure the pros and cons of BGP routing (used to select routes)

2. Classification:

  •    Recognized attribute Well-Known
  •       Well-Known mandatory
  •       Well-Known discretionary
  •    Optional attributes
  •       Optional non-transitive
  •       Optional non-transitive

It is recognized that the attribute must be complied with : all BGP update messages must contain this attribute
>>>AS-path
>>>next-hop
>>>Origin

Recognized self-determination attribute : This attribute is optional or not, but all BGP processes can recognize
>>>local preferent

Optional transmission attribute : even if the BGP process does not recognize the attribute, it will continue to be transmitted
>>>community attribute (community)

Optional non-transitive attributes : If the BGP process does not recognize this attribute, you can ignore this update and not pass it on
>>>MED

Principles of BGP routing:

  • 1. If the next hop of this route is unreachable, ignore this route

       2. The higher the value of the preferred-Value, the higher the priority. It is a private attribute of Huawei, which is only meaningful locally

  • 3. The route with the highest Local-preference value is preferred

       4. Aggregated routes take precedence over non-aggregated routes

  • 5. The priority of local manually aggregated routes is higher than that of local automatically aggregated routes
  • 6. The priority of the local routes imported through the Network command is higher than the local routes imported through the import-route command
  • 7. The path with the shortest AS-path length is preferred

       8. Comparing Origin attribute, IGP is better than Incomplete due to EGP, EGP

  • 9. Choose a route with a smaller MED

       10. EBGP routing is better than IBGP routing
       11. BGP preferentially selects the path with the lowest IGP metric value to the next hop of BGP

       When all the above are the same, it is equal-cost routing and can be load-sharing (note: AS_path must be the same, when load-sharing, the following 3 principles are invalid)
       12. Compare the length of Cluster_list, the shorter one is preferred
       13. Compare Originator_ID (if there is no Originator_ID, Use Router_ID to compare), choose a path with a smaller value

  • 14. Compare the IP addresses of peers and choose the path with the smallest IP address value

BGP attribute routing configuration
1. According to Local-prefernce control routing (the larger the better), it
is a recognized free attribute, which is used to tell routers in the AS which path is the preferred path to leave the AS. The
Local_preference attribute can only be used on IBGP peers (Unless a policy is made, the Local_preference value will not be lost during the transfer process between IBGP peers), but cannot be transferred between EBGP peers. If it is in the path attribute of the route received between EBGP peers Carrying Local_preference will trigger the Notifacation message and cause the session to be interrupted.
However, the Import direction policy can be used on the AS border router to modify the Local_preference attribute value. That is, after receiving the route, assign Local_preference to the route locally

2. Use the AS-path attribute to control route selection (the less the better), which
is a recognized obligatory attribute. It is a list of AS numbers
that the route to the target network passes through. It is used to ensure that routes are transmitted between EBGP peers without loops; in addition, As one of the criteria for routing optimization, when a
route is advertised to an EBGP peer, the router will add the local AS number to the AS_path of the route; when the route is advertised to an IBGP peer, the AS-path will not occur change

Use route-policy to modify the AS_path of BGP routing:
   apply as-path xxx additive Add xxx
   apply as-path xxx overwrite to the existing AS_path to replace (overwrite) the existing AS_path value with xxx
   apply as-path none overwrite Clear the route AS_path attribute

When using route-policy to modify the AS_path of a BGP route, the AS_path attribute of the EBGP route can be changed between EBGP peers, thereby affecting the optimization of BGP routes. On Huawei routers, between IBGP peers, you can also use route-policy to modify the AS_path of BGP routes. Regardless of the scenario, you must be very careful to change the AS_path of the BGP route. It is recommended to keep the same with the last passed AS number.

The Bestroute as-path-ignore command is
used to configure BGP to ignore AS path attributes when selecting the best route. After configuring this command, BGP will not compare the length of the AS path. By default, the shorter length is better

3. Controlling route selection through the MED attribute (the smaller the better)
is an optional non-transitive attribute, which is a metric value.
Generally, BGP devices only compare the MED attribute values ​​of routes from the same AS (different peers). You can configure commands to allow BGP to compare the MED attribute values ​​of routes from different ASs. After executing the compare-different-as-med command, the system will compare the MED values ​​of routes from peers in different ASs

In the case of multiple network segments, only a certain network segment is matched.
Origin is a publicly observable one. It is used to define the source of path information. Its function is to mark how a route becomes a BGP route. It works between EBGP neighbors. There are three types Attributes:
IGP (i): the highest priority EGP (e): the second priority Incomplete (?): the lowest priority


BGP route reflector
In the AS, in order to ensure the connectivity between IBGP peers, it is necessary to establish a fully connected relationship between IBGP peers. When the number of IBGP peers is large, the cost of establishing a fully connected network is high. The route reflector (RR) can be used to solve this problem.
The cluster ID is used to prevent multiple route reflectors in the cluster and routing loops between clusters. When a cluster manages multiple route reflectors, the same cluster ID must be configured for all route reflectors in the same cluster

RR advertises routing rules to IBGP neighbors as follows:
   routes learned from non-clients, advertised to all clients
   , routes learned from clients, and advertised to all non-clients and clients (except the client that initiated this route)
   from The routes learned by EBGP peers are advertised to all non-clients and clients

BGP route aggregation (summarization)
solution 1 : Create a static summary route
ip route-static 192.168.0.0 255.255.252.0 NULL0
network 192.168.0.0 255.255.252.0
## Advertise the aggregated route, because the manually summarized 192.168.0.0 is in The routing table does not exist, it must be added to NULL0 in order to use the above network to advertise this route in the bgp process

Solution 2 : aggregate 192.168.0.0 255.255.252.0 detail-suppressed as-set
##Configure aggregate for manual route aggregation. When detail-suppressed, the notification of detailed routes is suppressed. After the as-set keyword is added, the summary route will inherit the detailed route. The path attribute of the detailed routing AS_path attribute can play a role in summary routing loop prevention

Guess you like

Origin blog.csdn.net/weixin_53496478/article/details/112604013
BGP