12.16 Implementing BGP

The single best path toward a destination are as follows. Note that only routes with no AS loops and that have a valid next-hop are candidates for this selection process.

The following order is used by Cisco routers:

  1. Prefer the highest weight (local to the router) — default = 0
  2. Prefer the highest local preference (propagated to other routers within the AS) — default = 100
  3. Prefer a route originated by the local router (where next hop is 0.0.0.0)
  4. Prefer the shortest AS Path
  5. Prefer the lowest origin code (where i < e < incomplete)
  6. Prefer the lowest MED (exchanged between autonomous systems)
  7. Prefer an EBGP path over an IBGP path
  8. Prefer the path through the closest IGP neighbor
  9. Prefer the oldest route for EBGP paths
  10. Prefer the path with the lowest neighbor BGP RID
  11. Prefer the path with the lowest neighbor IP address

Notes:

  • The MED is only compared if the paths were originated in the same AS. To always check MED, the Cisco command bgp always-compare-med can be entered to require it, allowing MED to be applicable for comparison when prefixes originate in different ASNs.
  • IETF and Cisco differ in the value assigned to a missing MED. Where the IETF assigns a value of infinity to a missing value, making it the least preferred, Cisco makes it the most preferred (zero). To change the Cisco value to match the IETF standard, enter the bgp bestpath missing-as-worst command.
  • Origin Codes: “i” is typically seen when a route is advertised locally with the network keyword. “e” is learned through another peer/speaker, while “?” is incomplete, typically due to redistribution from static route or other IGP.