Enhance your Career in Networking With IPinBits!!!​

BGP Path Selection mechanism

IGPs such as RIP and OSPF chooses the best path on the basis of metric defined by the protocol i.e RIP metric is HOP count and OSPF metric is COST. But as we Discussed BGP is a PATH VECTOR protocol and it shares alot of path attributes in the updates. So its time to use the path attributes. Yes, BGP uses different parameters for best path selection. Lets have a look how BGP path selection takes palace :-

  1. WEIGHT – Only in CISCO, Highest is preferred.
  2. LOCAL PREFERENCE – Highest LP is preferred.
  3. SELF ORIGIN – Routes which are self originated via network or aggregate command. NOTE :- If AIGP is enabled the prefer the path with lower AIGP attribute.
  4. AS _ATH – Prefer the shortest AS path.
    – This step is skipped if you have configured the “bgp bestpath as-path ignore” command.
    – An AS_SET counts as 1, no matter how many ASs are in the set.
    – The AS_CONFED_SEQUENCE and AS_CONFED_SET are not included in the AS_PATH length.
  5. ORIGIN – Prefer { i < e< ? } in order.
  6. M.E.D – Lowest MED is preferred. 

    – This comparison only occurs if the first (the neighboring) AS is the same in the two paths. Any confederation sub-ASs are ignored. In other words, MEDs are compared only if the first AS in the AS_SEQUENCE is the same for multiple paths. Any preceding AS_CONFED_SEQUENCE is ignored.
    – If bgp always-compare-med is enabled, MEDs are compared for all paths. You must disable this option over the entire AS. Otherwise, routing loops can occur.
    – Paths received with no MED are assigned a MED of 0, unless you have enabled bgp bestpath med missing-as-worst. If you have enabled bgp bestpath med missing-as-worst , the paths are assigned a MED of 4,294,967,294.
    – The bgp deterministic-med command can also influence this step.

  7. Prefer eBGP over iBGP.
  8. Lower IGP metric to BGP next hop.
  9. Oldest route
  10. Lower BGP neighbor R-ID.
  11. If R-ID is same, prefer the path with Minimum cluster list.
  12. Lowest Neighbor interface IP.

    Related blog posts