Path selection
1.5.b i Attributes
General information on “BGP Attributes”:
- If two or more paths exist, different BGP attributes will be compared in an exact order to choose the best path
- BGP attribute types:
- Well-known mandatory:
- Must be recognized by all BGP routers.
- Must be present in all BGP updates.
- Must be passed on to other BGP routers.
- Example: AS_PATH, ORIGIN, NEXT_HOP.
- Well-known discretionary:
- Must be recognized by all BGP routers.
- Must NOT be present in all BGP updates.
- Must be passed on to other BGP routers.
- Example: LOCAL_PREFERENCE.
- Optional transitive:
- Must not be recognized by all BGP routers.
- Must be passed on to other BGP routers (even if not recognized).
- Example: AGGREGATOR, COMMUNITY.
- Optional non-transitive:
- Must not be recognized by all BGP routers.
- Must NOT be passed on to other BGP routers.
- Example: MED, ORIGINATOR_ID.
- Well-known mandatory:
1.5.b ii Best path selection algorithm
General information on “BGP Best path selection algorithm”:
- Controls which route goes from the BGP table to the routing table and is advertised to other peers
- For a path to be selected as “best”, its next-hop must be in the routing table and reachable via recursive routing
- AS-Path must not contain local-AS (this issue can be overcome with allowas-in or as-override)
- BGP Path selection attributes (in tie-breaker order):
- WEIGHT (locally significant, Cisco proprietary, higher is better)
- LOCAL PREFERENCE (significant within an AS, not advertised to eBGP, carried through confederation, higher is better)
- ORIGINATED (where the route comes from, local is considered best)
- AS-PATH (shorter is better, AS numbers make no difference, eg. AS_PATH 10 20 is equal to AS_PATH 1000 2000)
- ORIGIN (IGP > EGP > Incomplete)
- MED (=metric/distance, therefor lower value will be preferred, only compared between peerings to the same provider/AS, IGNORED by default (can be changed) if two different AS’es advertise different MEDs for a single prefix)
- PATHS (eBGP > eBGP Confederations > iBGP)
- IGP METRIC (prefer the path with the lowest IGP metric to the BGP NEXT_HOP attribute)
- OLDEST PATH (prefer the path that was received first = oldest) (Important: Skipped if bgp bestpath compare-routerid is enabled)
- ROUTER-ID (lower is better)
- LOWEST NEIGHBOR IP (prefer the path with the lowest neighbor IP address)
MNEMONIC:
We Love Oranges AS Oranges Mean Pure Intelligent Organic Refreshment Levels
1.5.b iii Load balancing
General information on “BGP Load balancing”:
- By default, BGP only installs the best route in the routing table
- Pseudo load-balancing can be done with path manipulation
- Example: A BGP peer has several neighbors advertising different prefixes. Either the neighbors or the peer can modify different values of different prefixes so that for every prefix another link is preferred.
- Real load-balancing can be archived with the multipath or add-path feature
- This is explained under 1.5.f Other BGP features"