BGP is a path vector routing protocol, which is to exchange routing information between autonomous systems in order to discover the most efficient way to access data somewhere on the Internet. How do I choose the best path for routing? The Cisco borderless network reveals the BGP 14 route selection principles for us:
BGP Routing Principle: prerequisites (The next hop to the route, shutdown synchronization, route not punished, prefix not rejected by the inbound routing policy), the following principles:
1:weight The management weight first ( the larger the higher the first), this parameter is valid locally. Although the Weight property is Cisco Private, many vendors also have this property built-in (but cannot be displayed and modified), which ensures that locally originating routes are the highest priority, since the local originating route has a weight of 32768, from other BGP Peer learns to route a weight of 0.
2:local-pref Local Preferences (the larger the higher the precedence), This parameter is passed within this as. The local Preference property can only be passed between IBGP peers, and if a local Preference is carried in the path attribute of the route received between EBGP Peers, the notifacation message is triggered, causing the session to be interrupted.
3: router-local originating path takes precedence . The local originating path is characterized by a next-hop of 0.0.0.0,weight of 32768. Different ways such as network or redistribute can be used, so there is a principle of precedence between these methods: Network>redistribute>aggregate, but this principle is not used as a BGP routing policy.
4: Routing with Shortest As-path path (which is the least priority in As-path) takes precedence . However, you can configure the BGP bestpath As-path Ignore to ignore this step. Note: When you do an aggregation route, the length of the as number in the {} in the As-path list generated after using As-set is counted as the length of the as number only, and the as number in the As-path list in the Federation is not calculated! Route-map in different directions are different for the position of the inserted as number.
5: Compare Origin attribute, with lowest origin source code. priority order of three different Origin attributes: The Igp>egp>incomplete,origin property is always carried in BGP routing. It is rarely used to set the Origin property as a BGP routing policy.
6: Evaluate Med (the path with the lowest med value wins). by default, only the Med value of the BGP route from the same as is compared (which is the same as the first as in as-sequence). The command BGP always-compare-med compares med for all paths, regardless of whether they are from the same as. If this option is used, it should be configured as such in the AS (avoid routing loops). (any as-confed-sequence that starts with the comparison Med value is ignored if BGP always-compare-med is configured).
Med Note: Cisco recommends that the BGP deterministic-med command be enabled in all new network deployments. For an existing network, you must deploy this command on all routers at the same time, or deploy this command incrementally, but be careful to avoid possible internal BGP (IBGP) routing loops. When BGP receives multiple routes to a specific destination, it lists them in the reverse order in which they were received (from newest to oldest). BGP then compares the routes in the following order: Starting with the most recent entry and moving to the oldest entry (starting at the top of the list, moving down). For example, compare Entry1 with Entry2. The better of the two are then compared to the entry3, and so on. When the BGP deterministic-med command is enabled, the order is scrambled to group routes from the same autonomous system together and then compare the best entries for each group. Show IP BGP can see the effect.
If the BGP bestpath med confed command is activated, only the path of as-confed-sequence compares the Med value. If a path contains any external home-made systems, then no comparison is made.
7:EBGP is superior to IBGP; EBGP is superior to the federal EBGP(Federal EBGP and federal IBGP are not comparable and do not compare. Because both the federal EBGP and the federal IBGP are considered to have no difference in the internal path. If all the entries received by the EBGP peer or both are received from the IBGP peer or the entries received from the Federated EBGP and the Federated IBGP Peer, continue to the next step.
8:BGP First selects the path with the lowest measure value to the next hop IGP. ( whether it's ebgppeer or both Ibgppeer or the federal EBGP and the federal IBGP are comparing this step)
9: The 8 route selection principle for the current polygon is not optimal when selecting the best route, and Maximum-paths [IBGP] <1-16> is configured under the BGP process, then the equivalent load balancer will be performed, if there is no IBGP keyword, The equivalent load balancing will only be performed on the routes received by the EBGP peer, and if the maximum-paths is not configured then the next routing principle will be carried out.
Whether the route is IBGP or EBGP, the load balancing must be as-path exactly the same, both the As-set and the Federation sub-as must be identical, i.e. () and {} are identical, If there are any routes received by the Federated EBGP Peer and the federated IBGP Peer, they cannot be load balanced between the two.
Load Balancer show ip bgp x.x.x.x details to see that the multipath tag will be loaded into the routing table (show ip route).
10: When more than one route is received from EBGP (the external path, the federated EBGP Peer does not count, because it is an internal path), BGP takes precedence over the first received route entry (the oldest path). This minimizes the jitter of the route. If the BGP bestpath compare-routerid command is used under the BGP process, this principle is ignored, the 11th routing principle is skipped, and this principle is ignored when multiple routes have the same router-id, and this principle is ignored when there is no current best route. For example, the neighbor that provides the best path is down. (EBGP routing only)
the 11:BGP preferably has the lowest router-id route. If the path contains RR attributes, then the Originator-id is used instead of Router-id in the path selection process (that is, comparisons between Originator-id).
12: If Orginator-id is the same, then BGP optimizes cluster-list shortest path length. This occurs only in the context of the RR.
13: The preferred path from the lowest neighbor address (the neighbor address specified after neighbor), the smaller the higher the priority. This address is the address configured and used on the BGP peer, which is the address used by the local peer router when it configures the TCP neighbor and establishes a connection to the remote peer.
14:BGP Custom Path selection process : The extended community properties of the BGP cost Community (BGP costs community) provide a way to customize the best path selection process. This automatic path selection process is inserted after the 8th of the BGP13 rule (priority to the lowest path of the next hop Igp-cost), and the path with the lowest cost value is the preferred one. However, you can use the BGP bestpath cost-community Ignore to ignore this step and configure it in an as or federated configuration so that you can avoid routing loops.
The cost Community Setup clause is configured with cost Communityid (the costs group ID number 0 to 255) and cost number (the costs value 0 to 4,294,967,295). Compared with cost number, the Communityid cost is the lower the higher the priority. For paths that are not specifically configured with the costing value, the default value of 2,147,483,647 is specified. This value is the central point between 0 and 4,294,967,295. This property is passed to the neighbor with the send-community command.
This community attribute is a non-transitive extended community attribute. are passed to the IBGP and federated IBGP and EBGP peers and are not passed to the EBGP peer.
Cisco learning note--BGP14 Routing principles