Post

BGP Path Selection - Technical Notes

BGP Path Selection - Technical Notes

🧭 BGP Path Selection – Complete Technical Notes

For Interviewers, Learners, and Network Engineers


I. Beginner Level – Core Concepts & Attributes

📘 What is BGP Path Selection?

BGP (Border Gateway Protocol) is an Exterior Gateway Protocol (EGP) used to exchange routing information between Autonomous Systems (AS).
Unlike OSPF or EIGRP, BGP is policy-based, not metric-based — it uses multiple path attributes for decision-making.


🎯 Key Objectives of BGP Path Selection

BGP determines the best route using these five primary attributes:

#AttributeDescription
1WeightCisco proprietary; higher value preferred
2Local PreferenceInfluences routing within the AS; higher preferred
3AS PathFewer AS hops preferred
4OriginRoute source indicator; IGP > Incomplete
5MED (Multi-Exit Discriminator)Lower value preferred

🧠 Mnemonic for Attribute Order

“We Love Oranges As Oranges Mean Pure Refreshments”

MnemonicAttributePreference
WeWeightHigher is better
LoveLocal PreferenceHigher is better
OrangesOriginated LocallyLocally originated routes preferred
AsAS PathShorter is better
OrangesOrigin CodeIGP (i) > Incomplete (?)
MeanMEDLower is better
PurePath TypeeBGP > iBGP
RefreshmentsRouter IDLower is better

⚙️ Attribute Highlights

AttributeTypeScopeDefaultNotes
WeightCisco proprietaryLocal to router0 (learned), 32768 (local)Not advertised to peers
Local PreferenceWell-known discretionaryEntire AS100Shared within iBGP peers
AS PathWell-known mandatoryGlobalCounts AS hops
Origin CodeWell-known mandatoryGlobali (IGP) > ? (Incomplete)
MEDOptional non-transitiveBetween ASesLower preferred, not passed beyond neighbor AS

II. Intermediate to Advanced Level – Technical Criteria & Configuration

🔖 A. BGP Attribute Classification

TypeDescriptionExamples
Well-Known MandatoryMust exist in all updates, understood by all vendorsAS Path, Origin
Well-Known DiscretionaryUnderstood by all vendors, may not appearLocal Preference
Optional TransitiveMay not be understood, but carried across ASesCommunities
Optional Non-TransitiveNot understood or carried beyond neighbor ASMED, Weight (Cisco)

⚡ B. Full BGP Path Selection Criteria (Top–Down)

BGP always follows the same decision order.
If a tie occurs at one level, it continues to the next.

StepCriteriaPreference Rule
1Next-Hop ReachabilityMust be reachable
2Highest WeightHigher wins
3Highest Local PreferenceHigher wins
4Locally Originated RoutePrefer self-originated
5Shortest AS PathFewer AS hops preferred
6Lowest Origin CodeIGP (i) > Incomplete (?)
7Lowest MEDLower wins
8eBGP over iBGPExternal routes preferred
9Lowest IGP Metric to Next HopLower metric preferred
10Oldest PathMore stable route preferred
11Lowest BGP Router IDSmaller ID preferred
12Shortest Cluster ListUsed with Route Reflectors
13Lowest Neighbor IPUsed as final tiebreaker

🧩 C. Configuration & Attribute Manipulation Rules

Attributes are applied in the direction of control-plane updates.

AttributeDirectionScope / ImpactExample Command
WeightInbound onlyLocal router onlyset weight 1000
Local PreferenceInbound from eBGP / Outbound to iBGPEntire ASset local-preference 200
AS PathInbound / OutboundMakes path appear longerset as-path prepend 100 100 100
OriginInbound / OutboundAffects route preferenceset origin incomplete
MEDOutbound to eBGPAffects neighbor’s path selectionset metric 50

🧱 D. Configuration Differences – Cisco IOS XE vs IOS XR

PlatformPolicy MechanismMatching MethodImplicit Deny BehaviorNotes
Cisco IOS XE (XZ)Route Mapmatch ip address <ACL>Must include a final permit for unmatched routesCommon in classic IOS/IOS-XE
Cisco IOS XR (XR)Route Policy (RPL)if destination in <prefix-set>Must include else passModular and reusable
XR eBGP DefaultRoutes blocked unless explicit passPolicy required for eBGP peers

🧮 BGP Path Manipulation Summary

ScenarioAttribute to TuneDirectionUse Case
Prefer local exit within ASLocal PreferenceInboundInternal traffic control
Prefer one ISP over anotherWeightInboundLocal outbound path selection
Make path less preferredAS Path PrependOutboundInfluence inbound traffic
Influence neighbor’s choiceMEDOutboundEncourage entry via certain link
Modify origin typeOriginOutboundAdjust route preference

🧠 Real-World Key Points

  • Weight – Local-only, not shared.
  • Local Preference – Shared within AS via iBGP.
  • AS Path Prepending – Used to influence inbound traffic.
  • MED – Only applies between directly connected ASes.
  • eBGP > iBGP – Always preferred when all else is equal.
  • Router ID – Final tie-breaker.

III. Quick Revision & Interview Shortcut

StepAttributePreferred
1Next-Hop ReachabilityMust be reachable
2WeightHigher
3Local PreferenceHigher
4Originated LocallyYes
5AS PathShorter
6Origin CodeIGP (i)
7MEDLower
8Path TypeeBGP
9IGP MetricLower
10AgeOlder
11Router IDLower
12Cluster ListShorter
13Neighbor IPLower

IV. Essential Interview & Exam Keywords

BGP Decision Process, AS Path Prepend, Local Preference,
Weight vs MED, iBGP vs eBGP, Well-Known Attributes,
Optional Attributes, Route Map, RPL, Policy Control,
Cisco IOS XE, Cisco IOS XR.


End of Notes – “BGP Path Selection Complete Technical Guide”

🙌 Connect With Me

GitHub LinkedIn YouTube Gmail

This post is licensed under CC BY 4.0 by the author.