as the best BGP path.
Content 6.5 Selecting a BGP Path 6.5.11 Path Selection with Multihomed Connection An autonomous system rarely implements BGP with only one EBGP connection. This situation generally means that multiple paths exist for each network in the BGP forwarding database. If only one path exists, if it is loop-free and synchronized with the IGP for IBGP, and if the next hop is reachable, the path is submitted to the IP routing table. There is no path selection taking place because there is only one path, and manipulating it produces no benefit. Figure highlights the most common reasons for path seletion. Without route manipulation, the most common reason for path selection is Step 4, the preference for the shortest autonomous system path. Step 1 looks at weight, which by default is set to 0 for routes that were not originated by this router. Step 2 compares local preference, which by default is set to 100 for all networks. Both of these steps have an effect only if the network administrator configures the weight or local preference to a nondefault value. Step 3 looks at networks that are owned by this autonomous system. If one of the routes is injected into the BGP table by the local router, the local router prefers it to any routes received from other BGP routers. Step 4 selects the path that has the fewest autonomous systems to cross. This is the most common reason a path is selected in BGP. If a network administrator does not like the path with the fewest autonomous systems, the administrator needs to manipulate the weight or local preference to change which outbound path BGP chooses. Step 5 looks at how a network was introduced into BGP. This introduction is usually accomplished either with network statements (i for an origin code) or through redistribution (? for an origin code). Step 6 looks at MED to judge where the neighbor autonomous system wants this autonomous system to send packets for a given network. Cisco sets the MED to 0 by default; therefore, MED does not participate in path selection unless the network administrator of the neighbor autonomous system manipulates the paths using MED. If multiple paths have the same number of autonomous systems to traverse, the second most common decision point is Step 7, which states that an externally learned path from an EBGP neighbor is preferred over a path learned from an IBGP neighbor. A router in an autonomous system prefers to use the ISP bandwidth to reach a network rather than using internal bandwidth to reach an IBGP neighbor on the other side of its own autonomous system. If the autonomous system path is equal and the router in an autonomous system has no EBGP neighbors for that network (only IBGP neighbors), it makes sense to take the quickest path to the nearest exit point. Step 8 looks for the closest IBGP neighbor. The IGP metric determines what “closest” means; for example, RIP uses hop count, and OSPF uses the least cost based on bandwidth. If the autonomous system path is equal and the costs via all IBGP neighbors are equal, or if all neighbors for this network are EBGP, Step 9 is the next most common reason for selecting one path over another. EBGP neighbors rarely establish sessions at the exact same time. One session is likely to be older than another, so the paths through that older neighbor are considered more stable because they have been up longer. If all the listed criteria are equal, the next most common decision is to take the neighbor with the lowest BGP router ID, which is Step 10. If the BGP router IDs are the same (for example, if the paths are to the same BGP router), Step 11 states that the route with the lowest neighbor IP address is used.
Content 6.6 Manipulating BGP Path Selection with Route Maps 6.6.1 Setting Local Preference with Route Maps Unlike local routing protocols, BGP was never designed to choose the quickest path. BGP was designed to manipulate traffic flow to maximize or minimize bandwidth use. This figure demonstrates a common situation that can result when you are using BGP without any policy manipulation. Using default settings for path selection in BGP can cause uneven use of bandwidth. In Figure , router A in AS 65001 is using 60 percent of its outbound bandwidth to router X in 65004, but router B is using only 20 percent of its outbound bandwidth. If this utilization is acceptable to the administrator, no manipulation is needed. But if the load averages 60 percent and has temporary bursts above 100 percent of the bandwidth, this situation causes lost packets, higher latency, and higher CPU usage because of the number of packets being routed. When another link to the same location is available and is not heavily used, it makes sense to divert some of the traffic to the other path. To change outbound path selection from AS 65001, the network administrator must manipulate the local preference attribute. To determine which path to manipulate, the administrator performs a traffic analysis on Internet-bound traffic by examining the most heavily visited addresses, web pages, or domain names. This information can usually be found by examining network management records or firewall accounting information.
Content 6.6 Manipulating BGP Path Selection with Route Maps 6.6.2 Setting Local Preference with Route Maps Example In Figure , assume that 35 percent of all traffic from AS 65001 has been going to www.cisco.com. The administrator can obtain the Cisco address or AS number by performing a reverse Domain Name System (DNS) lookup or by going to www.arin.net and looking up the AS number of Cisco Systems or the address space that is assigned to the company. After this information has been determined, the administrator uses local preference and route maps to manipulate path selection for the Cisco network. Using a route map, router B can announce all networks that are associated with that autonomous system with a higher local preference than router A announces for those networks. Other routers in AS 65001 running BGP prefer the routes with the highest local preference. For the Cisco networks, router B announces the highest local preference, so all traffic destined for that autonomous system exits AS 65001 via router B. The outbound load for router B increases from its previous load of 20 percent to account for the extra traffic from AS 65001 destined for Cisco networks. The outbound load for router A, which was originally 60 percent, should decrease, and this change brings the outbound load on both links into relative balance. Just as there was a loading issue outbound from AS 65001, there can be a similar problem inbound. Maybe the sales web servers are located on the same subnet behind router B, causing the inbound load for router B to average higher utilization. To manipulate how traffic enters an autonomous system, use the BGP MED attribute. For example, AS 65001 announces a lower MED for network 192.168.25.0/24 to AS 65004 out router A. This MED is a recommendation to the next autonomous system on how to enter AS 65001; however, the MED is not considered until Step 6 of the BGP path selection process. If AS 65004 prefers to keep its autonomous system path via router Y to router B in AS 65001, AS 65004 simply needs to have router Y announce a higher local preference to the BGP routers in AS 65004 for network 192.168.25.0/24 than router X announces. The local preference that router Y advertises to other BGP routers in AS 65004 is evaluated before the MED coming from router A in AS 65001. MED is considered a recommendation because the receiving autonomous system can override it by having that autonomous system manipulate a value before the MED is considered. In the figure, assume that 55 percent of all traffic is going to the 192.168.25.0/24 subnet (router A). The inbound utilization to router A is averaging only 10 percent, but the inbound utilization to router B is averaging 75 percent. If AS 65001 were set to prefer to have all traffic going to 192.168.25.0/24 enter through router A from AS 65004, the load inbound on