Tuesday 19 February 2019

BGP Series 14: BGP Path Attributes and BGP Best Path Algorithm

BGP Path Attributes and BGP Best Path Algorithm:

.

  • BGP uses different path attributes to calculate the best path to a certain destination

  • But, they can also be used for a variety of things other than best path calculation such as AS_PATH attribute for loop-detection, …

  • Each path-attribute describes something about the path

  • The most common bgp path attributes are:

    • Weight
    • Local Preference
    • AS_PATH
    • Origin
    • Multi Exit Discriminator (MED)
  • When BGP has two routes to the same prefix, then, it starts comparing both the routes based on path attributes to decide on the best path (always only one best path)

    • img
  • Complete list of tie-breaker for choosing the best path for a prefix is:

    • N: Next-Hop; should be reachable

    • W: Weight; bigger value is preferred (Weight is Cisco-proprietary)

    • L: Local Preference; bigger is preferred

    • L: Locally Originated Routes

    • A: AS_PATH length; smaller length is preferred

    • O: Origin; Prefer i>e>?

    • M: MED; smaller is preferred (often called metric)

    • N: Neighbor Type; prefer eBGP path over iBGP

    • I: IGP Metric to next-hop; smaller value is preferred

      If all the above has a tie, then, below tie-breakers are considered:

    • Oldest (longest-known) eBGP Route

    • Lowest neighbor BGP RID

    • Lowest Neighbor IP address

    • The pneumonic to remember this is: “We Love Oranges AS Oranges Mean Pure Refreshment”
    • img
    • Another pneumonic is NWLLA OMNI:
    • img
  • BGP Path Attributes are classified into following categories:

    • img

    • Well-known: All bgp speakers will understand what it means

      • Mandatory: They always have to be in every update between bgp peers ----> next-hop, AS_PATH, Origin Code
      • Discretionary: All bgp speakers will understand this, but this attribute may/may not be present in a BGP update. It’s up to the discretion of BGP speaker to send or not to send these attributes in the update messages to the peers. ----> LOCAL_PREF, ATOMIC_AGGREGATE
    • Optional: These are optional and speaker may or may not understand. Based on whether the transitive flag bit is set or not in the update, it can be either transitive or non-transitive

      • Transitive: If a bgp speaker receives an BGP update having transitive bit set and there are some attributes that are not supported, even then, we should accept it and send it to our neighbors. Here, this router will set the ‘Partial’ bit and advertise to neighbor which essentially means ‘I don’t understand what this attribute means, maybe you will’ ---> AGGREGATOR, COMMUNITY
      • Non-Transitive: If a bgp speaker receives an BGP update with transitive bit not-set, and if the BGP process does not recognize the attribute then it can ignore the update and not advertise the path to its peers. ---> MED

No comments:

Post a Comment