BGP Best Path Selection: Simple explanation

Share it!

BGP is a routing protocol used to dynamically route packets in the correct destination. In order to accomplish that, there are some parameters to examine in order to identify which path is the best and which one should be added to the RIB. Below, the steps of the best path algorithm are explained with a brief description and some important details. In total there are 14 steps.

  1. Weight
    • Weight is a Cisco proprietary path attribute
    •  It has local significance and is not advertised to other neighbors
    • Can be set in an inbound rule to influence outbound traffic
    • Higher value wins
  2.  Local Preference
    • Well known optional attribute
    • It is advertised inside the same AS
    • It shows preference to exit the AS
    • Can be set in an inbound rule to influence outbound traffic
    • Higher value wins
  3. Locally originated or redistributed from IGP
    • Advertised using the “network” or “aggregate” command
    • Inserted to BGP by redistribution
  4. AIGP –  https://tools.ietf.org/html/rfc7311
    • Optional non-transitive attribute
    • When you own multiple IGP and BGP ASs
    • It takes as consideration the metric/cost of the IGP
  5. AS_PATH
    • Well known mandatory attribute
    • The shortest path is preferred
    • Can be used to influence inbound traffic (prepend)
  6. Origin
    • Well known mandatory attribute
    • Advertised with “network” command symbol -> i
    • Redistributed symbol -> “incomplete” or ?
    • Preference order: IGP > EGP > Incomplete
  7. MED
    • Optional non-transitive attribute
    • The value is called “metric”
    • If MED metric is received, it is advertised internally to the AS only
    • It is applicable for paths for the same ASN
    • You advertise it to influence inbound traffic
    • Lower metric is preferred
  8. eBGP vs iBGP
    • Preference order : eBGP > Confederation > iBGP
  9. Lower metric to next_hop
    • The lower metric to reach the next_hop of the route
  10. ECMP enabled?
    • At this point, if multipath is enabled (maximum path), the routes are installed with equal path 
  11. Oldest eBGP path
    • The route from the oldest established BGP session is preferred
  12. Router ID
    • Optional non-transitive attribute
    • The lowest RID of the advertised routers is preferred
  13. Cluster_List length
    • Optional non-transitive attribute
    • Appended by route reflectors ( loop prevention mechanism)
    • It is an indication about how many hops has passed inside the AS
    • Lower length is preferred
  14. Lower neighbor address
    • This is applicable for iBGP
      1. In eBGP the tie brakes by the “oldest session” (step 11)

 

DISCLAIMER: This article is part of the larger collection of articles regarding the journey towards becoming a CCIE (so it is Cisco based). By no means this is something official. It is just what I understand from the networking world. I write this in order to be able to explain them better and learn the content. I hope you may find something useful and easy to understand. Please contact me if something is not correct, or needs more work.

 


Share it!

notis

I am a network engineer since 2014. My main goal and the purpose of this site is to document whatever I learn so I can explain them better and of course transfer the knowledge in really simple words. Please feel free to contact me or visit my profiles for more information.