NETS header NETS Homepage UCAR Homepage NCAR Homepage CISL Homepage NETS Homepage About NETS Work requests & support

BGP route selection algorithm

This cheat-sheet came from Cisco, so it is somewhat Cisco-centric.
  1. WEIGHT
    Ciscos prefer the path with the highest WEIGHT. WEIGHT is a Cisco-specific parameter. It is local to the router on which it is configured.
  2. LOCAL_PREF
    Prefer the path with the highest LOCAL_PREF. The default is 100, but on Ciscos you can change the default with the "bgp default local-preference" command.
  3. On Ciscos, prefer the path that was locally originated via a "network" or "aggregate" BGP subcommand or through redistribution from an IGP. Local paths that are sourced by the "network" or "redistribute" commands are preferred over local aggregates that are sourced by the aggregate-address command.
  4. AS_PATH
    Prefer the path with the shortest AS_PATH. This step is skipped if you have configured the Cisco "bgp bestpath as-path ignore" command.
  5. Prefer the path with the lowest origin type. IGP is lower than Exterior Gateway Protocol (EGP), and EGP is lower than INCOMPLETE.
  6. MED
    Prefer the path with the lowest multi-exit discriminator (MED). Be aware of these items:
  7. Prefer eBGP over iBGP paths. If bestpath is selected, go to Step 9 (multipath).
  8. Prefer the path with the lowest IGP metric to the BGP next hop. Continue, even if bestpath is already selected.
  9. Determine if multiple paths require installation in the routing table for BGP Multipath. Continue, if bestpath is not yet selected.
  10. When both paths are external, prefer the path that was received first (the oldest one). This step minimizes route-flap because a newer path does not displace an older one, even if the newer path would be the preferred route based on the next decision criteria (Steps 11, 12, and 13). Skip this step if any of these items is true:
  11. Prefer the route that comes from the BGP router with the lowest router ID. The router ID is the highest IP address on the router, with preference given to loopback addresses. Also, you can use the "bgp router-id" command to manually set the router ID.
  12. If the originator or router ID is the same for multiple paths, prefer the path with the minimum cluster list length. This is only present in BGP RR environments. It allows clients to peer with RRs or clients in other clusters. In this scenario, the client must be aware of the RR-specific BGP attribute.
  13. Prefer the path that comes from the lowest neighbor address. This address is the IP address that is used in the BGP neighbor configuration. The address corresponds to the remote peer that is used in the TCP connection with the local router.

Address comments or questions about this Web page to the Network Engineering & Telecommunications Section (NETS) by opening a ticket at netshelp@ncar.ucar.edu. The NETS is part of the Computational & Information Systems Laboratory (CISL) of the National Center for Atmospheric Research (NCAR). NCAR is managed by the University Corporation for Atmospheric Research (UCAR). This website follows the UCAR General Privacy Policy and the NCAR/UCAR/UCP Terms of Use. The National Center for Atmospheric Research is sponsored by the National Science Foundation (NSF). Any opinions, findings and conclusions or recommendations expressed in this material do not necessarily reflect the views of the National Science Foundation.