well-known discretionary attribute that provides an indication to routers in the autonomous system about which path is preferred to exit the autonomous system. A path with a higher local preference is preferred. The local preference is an attribute that is configured on a router and exchanged among routers within the same autonomous system only. The default value for local preference on a Cisco router is 100. In Figure , AS 64520 receives updates about network 172.16.0.0 from two directions. The local preference on router A for network 172.16.0.0 is set to 200, and the local preference on router B for network 172.16.0.0 is set to 150. Because the local preference information is exchanged within AS 64520, all traffic in AS 64520 addressed to network 172.16.0.0 is sent to router A as an exit point from autonomous system 64520 (because of its higher local preference).
Content 6.5 Selecting a BGP Path 6.5.7 MED Attribute The MED attribute, also called the metric, is an optional nontransitive attribute. The MED is an indication to EBGP neighbors about the preferred path into an autonomous system. The MED attribute is a dynamic way to influence another autonomous system about which path that it should choose to reach a certain route in their autonomous system when multiple entry points exist. A lower metric is preferred. Unlike local preference, the MED is exchanged between autonomous systems. The MED is sent to EBGP peers. Those routers propagate the MED within their autonomous system, and the routers within the autonomous system use the MED but do not pass it on to the next autonomous system. When the same update is passed on to another autonomous system, the metric is set back to the default of 0. MED influences inbound traffic to an autonomous system, and local preference influences outbound traffic. By default, a router compares the MED attribute only for paths from neighbors in the same autonomous system. Note
The MED attribute means that BGP is the only protocol that can affect how routes are sent into an autonomous system. In Figure , the router B MED attribute is set to 150, and the router C MED attribute is set to 200. When router A receives updates from routers B and C, it chooses router B as the best next hop because its MED of 150 is less than router C.
Content 6.5 Selecting a BGP Path 6.5.8 Weight Attribute The weight attribute is a Cisco attribute for path selection. The weight is configured locally on a router and is not propagated to any other routers. This attribute applies when you are using one router with multiple exit points in autonomous system, as opposed to the local preference attribute, which is used when two or more routers provide multiple exit points. The weight can have a value from 0 to 65535. By default, paths that the router originates have a weight of 32768, and other paths have a weight of 0. Routes with a higher weight are preferred when multiple routes exist to the same destination. In Figure , routers B and C learn about network 172.20.0.0 from AS 65250 and propagate the update to router A. Router A has two ways to reach 172.20.0.0, and it has to decide which route to take. In the example, router A sets the weight of updates coming from router B to 200 and the weight of those coming from router C to 150. Because the weight for router B is higher than router C, router A uses router B as a next hop to reach 172.20.0.0.
Content 6.5 Selecting a BGP Path 6.5.9 Determining the BGP Path Selection Multiple paths may exist to reach a given network. As paths for the network are evaluated, those determined not to be the best path are eliminated from the selection criteria but are kept in the BGP forwarding table (which can be displayed using the show ip bgp command) in the event that the best path becomes inaccessible. BGP is not designed to perform load balancing. Paths are chosen because of policy, not based on bandwidth. The BGP selection process eliminates any multiple paths until a single best path is left. The best path is submitted to the routing table manager process and is evaluated against any other routing protocols that can also reach that network. The route from the source with the lowest administrative distance is installed in the routing table. The decision process is based on the attributes described earlier.
Content 6.5 Selecting a BGP Path 6.5.10 Selecting a BGP Path After BGP receives updates about different destinations from different autonomous systems, it chooses the best path to reach a specific destination. The decision process is based on the BGP attributes. BGP considers only synchronized routes with no autonomous system loops and a valid next hop. The following process summarizes how BGP chooses the best route on a Cisco router:
  1. Prefer the route with the highest weight. (The weight attribute is proprietary to Cisco and is local to the router only.)
  2. If multiple routes have the same weight, prefer the route with the highest local preference value. (The local preference is used within an autonomous system.)
  3. If multiple routes have the same local preference, prefer the route that the local router originated. A locally originated route has a next hop of 0.0.0.0 in the BGP table.
  4. If none of the routes were locally originated, prefer the route with the shortest autonomous system path.
  5. If the autonomous system path length is the same, prefer the lowest origin code (IGP < EGP < incomplete).
  6. If all origin codes are the same, prefer the path with the lowest MED. (The MED is exchanged between autonomous systems.) The MED comparison is made only if the neighboring autonomous system is the same for all routes considered, unless the bgp always-compare-med command is enabled.
Note
The most recent Internet Engineering Task Force (IETF) decision regarding BGP MED assigns a value of infinity to the missing MED, making the route lacking the MED variable the least preferred. The default behavior of BGP routers running Cisco IOS software is to treat routes without the MED attribute as having a MED of 0, making the route lacking the MED variable the most preferred. To configure the router to conform to the IETF standard, use the bgp bestpath missing-as-worst command.
  1. If the routes have the same MED, prefer external paths to internal paths.
  2. If synchronization is disabled and only internal paths remain, prefer the path through the closest IGP neighbor, which means that the router prefers the shortest internal path within the autonomous system to reach the destination (the shortest path to the BGP next hop).
  3. For EBGP paths, select the oldest route to minimize the effect of routes going up and down (flapping).
  4. Prefer the route with the lowest neighbor BGP router ID value.
  5. If the BGP router IDs are the same, prefer the router with the lowest neighbor IP address.
Only the best path is entered in the routing table and propagated to the BGP neighbors of the router. Note
The route selection process summarized here does not cover all cases but is sufficient for a basic understanding of how BGP selects routes. For example, suppose there are seven paths to reach network 10.0.0.0. All paths have no autonomous system loops and have valid next-hop addresses, so all seven paths proceed to Step 1, which examines the weight of the paths. All seven paths have a weight of 0, so they all proceed to Step 2, which examines the local preference of the paths. Four of the paths have a local preference of 200, and the other three have local preferences of 100, 100, and 150. The four with a local preference of 200 continue the evaluation process to the next step. The other three are still in the BGP forwarding table, but are currently disqualified as the best path. BGP continues the evaluation process until only a single best path remains, which is submitted to the IP routing table