BGP's Best Path Algorithm
Interior Gateway Protocol Cost
BGP can also take into consideration the cost of reaching the exit point from within the autonomous system; Figure 1-16 illustrates.
Figure 1-16: Interior Gateway Protocol Cost in BGP Metrics
At router C, the two paths advertised from AS 65200, and passed via iBGP through routers A and D, look the same. From C's perspective, the cost of transmitting the packet from the exit point to the final destination is the same, so it only makes sense to take the shortest path to the exit point from the AS. The easiest way to determine the shortest path to the exit point of the AS is to use interior gateway protocol metrics to compare the paths.
The IGP metric check assumes that the same IGP is running throughout the AS; if several different IGPs are running within the same AS, their metrics are not comparable, and the results of this check can actually produce suboptimal routing to the edge of the AS.
IGP metric allocation values are typically derived from a number of factors. For example, the number of "route miles" or "propagation delay" a particular connection uses may be factored. Other factors could include the available capacity of a link (e.g., a 1000 Mbps gigabit Ethernet connection would be 10 times more preferable than a 100 Mbps Fast Ethernet connection), or perhaps some multiple is used to reflect the reliability of the Physical Layer medium. The method used to derive IGP metrics varies widely among network operators and is influenced by many other factors as well (e.g., the available metric allocation range provided by the interior gateway protocol being used).
The BGP Identifier is a four-octet value exchanged with BGP peers in the Open message. The value of the BGP Identifier is determined on startup and is the same for all peers of the BGP speaker. If the value of the BGP Identifier changes all the BGP sessions must be reset and must be reinitiated using the new value. As such, the local BGP Identifier value is typically derived from an IP address associated with a loopback or other similar virtual system interface, so as to avoid potential instability introduced by interface or other hardware failures. Note that it is not a requirement that the value be derived from an active IP address on the local system, or that if it was, the address must remain active. However, the value must be unique within the routing system and not deriving the BGP Identifier value from an active system IP address may introduce conflicts. Typically, implementations first attempt to get the value from a virtual interface, though the value is often determined by using a value of the lowest IP address configured on any active interface on the BGP speaker.
The BGP Identifier is often referred to simply as router ID. The router ID of the advertising router is generally considered the "tie breaker" in the BGP bestpath algorithm; if multiple paths are identical in cost, using the router ID to break the tie allows the routing decision to be made deterministically throughout the autonomous system (hence the requirement for uniqueness of the value). If two paths have the same preferences throughout all of the other steps, the path through the advertising router with the lowest router ID will be considered the best path, installed in the local routing table, and advertised to peers.
Most implementations of BGP provide a mechanism that allow the network administrator to set the weight on a particular prefix such that it wins the local bestpath calculation without impacting the bestpath calculations used in the remainder of the network; this factor is normally referred to as the weight, and influences decisions only by the local router. Weight is not a defined BGP metric, and is not advertised as an attribute to a route in BGP, so it does not impact the routing decision at any other router in the network.
Note that caution should be taken when manipulating weight as it only impacts path selection on the local system and may potentailly result in routing loops.