Describes the 14 routing principles of BGP

Source: Internet
Author: User

BGP is a path vector routing protocol. Its job is to exchange route information between autonomous systems to find the most effective path for accessing data somewhere on the Internet. How do I select the optimal route? Cisco borderless networks reveal 14 BGP routing principles:

BGP routing principle: premise (the next hop of a route can be reached, synchronization is disabled, the route is not punished, and the prefix is not rejected by the inbound routing policy). The specific principles are as follows:

1: weight first compares management weights (the larger the weight, the higher the priority ),This parameter is valid locally. Although the Weight attribute is private to Cisco, many vendors also have built-in attributes (but cannot display and modify them), which ensures that the routes originating locally are the most preferred, because the Weight of the local originating route is 32768, the Weight of the route learned from other BGP peers is 0.

2: local-pref local preference (the larger the priority ),This parameter is passed in this. The Local Preference attribute can only be transmitted between IBGP Peer. If the path attribute of the route received between EBGP Peer carries the Local Preference, the Notifacation message is triggered, resulting in session interruption.

3: The router's local originating path takes precedence.. The Local Source Path is next-hop and weight is 32768. Different methods can be used, such as network or redistrigate. There is a priority between these methods: network> redistribute> aggregate, but this principle is not used as a BGP routing policy.

4: routes with the shortest AS-path PATH (that is, the AS-path has the lowest priority) are prioritized.. However, you can configure bgp bestpath as-path ignore to ignore this step. Note: When performing aggregation routing, the as number in {} in the AS-Path list generated after the AS-set is used is only the length of an AS number; the AS number length in the AS-Path list in the consortium is not calculated! Route-map in different directions has different positions for the inserted AS number.

5: Compare the origin attributes with the lowest source code.Priorities of three Origin attributes: IGP> EGP> incomplete. Origin attributes are always carried in BGP routes. Rarely use the Origin attribute as the BGP routing policy.

6: Evaluate MED (the path with the smallest MED value wins ).By default, only the MED values of BGP routes from the same AS are compared (that is, the first AS in AS-sequence is the same ). The command bgp always-compare-med compares all paths with MED, regardless of whether they come from the same. If this option is used, it must be configured in AS (to avoid routing loop selection ). (All values starting with as-confed-sequence are ignored and compared. If bgp always-compare-MED is configured, the comparison is performed ).

MED remarks: Cisco recommends that you enable the bgp deterministic-med command in all new network deployments. For an existing network, you must deploy this command on all routers at the same time or gradually deploy this command. However, be sure to avoid possible internal BGP (iBGP) routing loops. When BGP receives multiple routes to a specific target, it lists them in the reverse order of the received routes (from the latest to the oldest ). then, BGP compares routes in the following order: Starting from the latest entry and moving to the oldest entry (starting from the top of the list and moving down ). For example, compare entry1 with entry2. Then, compare the better of the two with entry3, and so on. When the bgp deterministic-med command is enabled, routes from the same autonomous system are grouped together in this Order and the best entries in each group are compared. Show ip bgp shows the effect.

If the bgp bestpath med confed command is activated, only the AS-Confed-sequence path can compare the MED value. If a path contains any external self-made system, no comparison is made.

7: EBGP is better than IBGP; EBGP is better than federated EBGP(Federated eBGP and federated iBGP are not comparable or compared. Because the federated ebgp and federated ibgp are regarded as internal paths, there is no difference ). If both the entries received by the EBGP peer or the entries received by the IBGP peer or the entries received by the federated EBGP and the federated IBGP peer respectively, continue to the next step.

8: BGP preferentially selects the path with the lowest measurement value for the next hop IGP. (Both EBGPpeer and IBGPpeer, or both EBGP and IBGP are compared)

9: When the eight routing principles listed above fail to select the optimal route, maximum-paths [ibgp] <1-16> is configured under the BGP process, the equivalent Server Load balancer will be executed. Without the ibgp keyword, only the equivalent Server Load balancer will be executed for the routes received by the EBGP peer, if maximum-paths is not configured, the next routing principle is implemented.

To achieve load balancing, routes received by both IBGP and EBGP must be exactly the same as-path, and those that contain as-set and federated sub-AS must be exactly the same, that is () it must be exactly the same as that in {}. If the federal EBGP peer and the Federal IBGP peer receive routes, load balancing cannot be performed between them.

Server Load balancer show ip bgp x. x details can be seen, all with the multipath mark will be loaded into the route table (show ip route ).

10: when multiple routes are received from EBGP (when the external path is used, the Federated EBGP peer is not counted because it is an internal path ), BGP preferentially uses the first received route entry (the oldest path ).This minimizes route jitter. If the BGP bestpath compare-routerid command is used in the bgp process, this principle is ignored and the 11th route selection principle is skipped. This principle is also ignored when multiple routes have the same router-id, this principle is also ignored when there is no current optimal route. For example, the neighbor that provides the optimal route is down. (Only ebgp Routing)

11: BGP preferably routes with the lowest router-id.If the path contains the RR attribute, originator-id will be used in the path selection process to compare the router-id (that is, compare between originator-id ).

12: If orginator-id is the same, BGP selects the path with the shortest cluster-list length.This only happens in the RR environment.

13: the path from the lowest neighbor address (the neighbor address specified after neighbor) is preferred.This address is the address configured and used on the BGP peer. This address is the address used by the local peer router to configure a TCP neighbor and establish a connection with the remote peer.

14: BGP custom path selection process: The extended group attributes of BGP Cost Community (BGP Cost group) provide a way to customize the best path selection process. This automatic path selection process is inserted after 8th BGP13 routing rules (the path with the lowest priority to the next hop IGP-cost). The path with the lowest cost value is preferred. However, you can use bgp bestpath cost-community ignore to ignore this step. During configuration, you must configure it in the AS or in the Federation to avoid routing loops.

The cost group setting clause uses cost communityID (cost group ID numbers 0 to 255) and cost number (cost number value 0 to 4,294,967,295) for configuration. Compared with cost number and cost communityID, the lower the value is, the higher the priority is given. For paths specially configured with unused cost serial numbers, the default cost serial number is 2,147,483,647. This value is the central point between 0 and 4,294,967,295. The send-community command is required when this attribute is passed to the neighbor.

This group attribute is a non-passed extended group attribute. It is passed to the IBGP and federated IBGP and EBGP peers, but not to the EBGP peer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.