Use it to explain why BGP chose a path, and to pick the attribute to change for a goal: LOCAL_PREF for the exit used by the whole AS, Weight for one router only, AS_PATH prepending or MED to influence how a neighbouring AS sends traffic in. The child Topics cover the full order (Best Path) and each attribute.
BGP Path Selection
BGP path selection is the ordered comparison BGP uses to pick one best path per prefix: Weight, LOCAL_PREF, local origination, AS_PATH length, ORIGIN, MED, eBGP over iBGP and IGP metric to the next hop, then tie-breakers. The first difference decides.
1. show ip bgp <prefix> — all candidate paths; > marks best, the reason is in the attributes.
2. Walk the order: weight → LOCAL_PREF → locally originated → AS_PATH length → origin → MED → eBGP over iBGP → IGP cost to next hop → oldest/router ID.
3. Best path missing from the RIB? Look for r (RIB-failure) and check next-hop reachability.
A route-map setting local preference, MED or prepending is configured, but the best path does not change.
Possible stored cause: The policy is applied in the wrong direction or to the wrong neighbor, does not match the prefixes, or the session was not refreshed.Check received/advertised routes for one prefix, then inspect best-path/RIB installation.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Do not equate Established with usable prefixes. A session can be healthy while policy filters the route, another path wins, the RIB rejects it, or the selected next hop is unresolved in the data plane.
Other frequent mistakes:
- Assuming shortest AS_PATH wins. Weight and LOCAL_PREF are compared first, so prepending cannot beat a higher LOCAL_PREF.
- Expecting Weight to influence other routers. It is local to the router where it is set and is never advertised.
- Expecting LOCAL_PREF to influence a neighbouring AS. It is carried only over iBGP; to influence inbound traffic use AS_PATH prepending, MED or communities agreed with the provider.
- Reading the trailing
iinshow ip bgpas "learned by iBGP". It is ORIGIN IGP. - Changing a route-map and expecting an immediate effect. Existing paths are re-evaluated only after a soft refresh or new update.
Operational reference
Fast context before you go deeper.
show bgp ipv4 unicast <prefix>Show Commands
Read-only Cisco show commands for confirming state, narrowing a fault and interpreting the current boundary.
show bgp ipv4 unicast <prefix>ReferenceBGP path attributes and best-path information for a prefix.
Cisco IOS XE · mixedshow ip bgp [prefix]ShowInspect BGP paths and attributes.
Use when: Best-path/policy analysis.
IOS/IOS XE · mixed · verifiesshow bgp ipv4 unicast neighbors {{neighbor}} advertised-routesShowShows routes advertised to a BGP neighbor.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors {{neighbor}} routesShowShows accepted routes from a BGP neighbor where supported.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors <neighbor>ReferenceShows BGP session capabilities, timers, message counters, policies and per-peer state.
Cisco IOS XE · mixedshow bgp ipv4 unicast community <community>ReferenceFilters BGP table output by community value where supported.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors <peer> | section CapabilReferenceInspect negotiated peer capabilities such as route refresh and address-family support.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors <peer>ReferenceInspect peer state, last reset reason, messages and negotiated session metadata.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors <peer> advertised-routesReferenceDisplay routes selected for advertisement to a specific peer.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors <peer> received-routesReferenceDisplay received routes when platform/configuration exposes pre-policy received state.
Cisco IOS XE · mixedshow bgp ipv4 unicast rib-failureShowDisplay BGP paths that were not installed in the IP routing table due to RIB-selection conditions.
Cisco IOS XE · mixedshow bgp ipv4 unicast neighbors <neighbor> received-routesReferenceInspect received routes when the platform/configuration retains that view.
Cisco IOS XE · mixedshow ip route [prefix]ShowDisplay IPv4 routing table.
Use when: Routing and forwarding verification.
Quick note: Use with show ip protocols for dynamic routing.
IOS/IOS XE · mixedshow ip cef [prefix]ShowInspect FIB/CEF forwarding entries.
Use when: Compare RIB and forwarding state.
IOS/IOS XE · mixed · verifiesHow to read the output
show bgp ipv4 unicast <prefix>Look first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors {{neighbor}} advertised-routesLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors {{neighbor}} routesLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors <neighbor>Look first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast community <community>Look first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors <peer> | section CapabilLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors <peer>Look first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors <peer> advertised-routesLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors <peer> received-routesLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast rib-failureLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show bgp ipv4 unicast neighbors <neighbor> received-routesLook first: paths, next hop, AS_PATH, local-pref/MED/weight, best marker
Healthy: Expected path is accepted and selected according to policy.
Warning: Unexpected best path, inaccessible next hop, missing path or policy attributes.
Does not prove: Best BGP path does not prove installation/forwarding if another boundary intervenes.
show ip route [prefix]Look first: route source/code, prefix, next hop, outgoing interface
Healthy: Expected prefix is installed with intended next hop/source.
Warning: Route absent, unexpected protocol/AD/metric, recursive next hop or wrong exit.
Does not prove: RIB presence does not prove FIB programming or packet delivery.
show ip cef [prefix]Look first: prefix adjacency/next hop and egress interface
Healthy: CEF resolves the prefix to the intended adjacency.
Warning: Drop/punt/unresolved adjacency or unexpected egress.
Does not prove: A CEF entry does not prove downstream reachability or return path.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
A route-map setting local preference, MED or prepending is configured, but the best path does not change.
Step 1 Verification & evidence Verify boundary
show ip bgp <prefix>; show route-map; show ip prefix-list; compare attributes of all candidate paths.
Step 2 Operational verification Verify boundary
Fast verification
show ip bgp <prefix>— are all expected paths present, valid, and is the intended one marked best?- Walk the order on the differing values: Weight → LOCAL_PREF → local origin → AS_PATH → ORIGIN → MED → eBGP/iBGP → IGP metric to NEXT_HOP.
show ip route <prefix>andshow ip bgp rib-failure— did the best path reach the routing table?show ip cef <prefix>— does forwarding resolve to the expected interface?
Failure boundary
Missing path = advertisement or filter problem; invalid path = NEXT_HOP reachability; wrong best = policy/attribute; best but not installed = administrative distance; installed but wrong traffic = forwarding or return path.
Step 3 Commands & verification Verify boundary
These commands belong to this topic because they answer a direct configuration, state or verification question:
show ip bgp— Inspect BGP paths and attributes.show ip bgp summary— Check BGP neighbor session state and prefix counts.show ip cef— Inspect FIB/CEF forwarding entries.show ip route— Display IPv4 routing table.
Do not treat one command as complete evidence. Combine the command output with the specific state or failure point described in the topic.
Step 4 Known-good, broken state and proof boundary Verify boundary
Known-good: all expected candidates are present and valid, the intended path is best because of the attribute your design sets, the routing table has the prefix as source B via that NEXT_HOP, and CEF forwards out the expected interface.
Proof boundary: show ip bgp <prefix> shows this router's view at this moment. It does not show what the neighbour AS prefers, how return traffic flows, or that a route reflector passed along every candidate.
Step 5 Observation-driven branch tree Narrow the fault
Start from show ip bgp <prefix> on the deciding router:
- Prefix not in the BGP table → session, neighbour advertisement or inbound filter. Not a path-selection problem.
- Path present but not valid → NEXT_HOP not reachable (
show ip route <next-hop>); for iBGP, checknext-hop-selfon the edge router. - Unexpected path is best → walk the decision order and find the first differing attribute; trace which route-map or neighbour setting created it.
- Expected path is best but not installed →
show ip bgp rib-failure; another route source with lower administrative distance wins. - Installed but traffic goes elsewhere →
show ip cef <prefix>and recursive next-hop resolution; then check the return path, which outbound preference does not control.
Step 6 Common failure modes Narrow the fault
Policy set on wrong direction, attribute not propagated as assumed, path filtered before selection or tie-break misunderstood.
Step 7 Troubleshooting workflow Narrow the fault
1. Pick one exact prefix and the router that makes the decision.
2. Confirm the expected neighbours are Established and that each one actually sent the prefix (show ip bgp neighbors <ip> routes).
3. show ip bgp <prefix>: are all expected paths present and valid? If not, the problem is NEXT_HOP reachability, inbound policy or an AS loop — not path selection.
4. Walk the decision order and find the first attribute that differs. Is that the attribute your design meant to decide?
5. If BGP picks the right path but traffic does not follow it, check show ip bgp rib-failure, show ip route <prefix> and show ip cef <prefix>.
6. Change one policy, soft-refresh the neighbour (clear ip bgp <ip> soft in) and repeat steps 3–5.
Typical causes: route-map applied in the wrong direction, an attribute that does not propagate where you expected (Weight never leaves the router, LOCAL_PREF never leaves the AS), MED compared across different neighbouring ASes, or a NEXT_HOP that iBGP peers cannot resolve.
Step 8 Troubleshoot one prefix through the policy chain Narrow the fault
Use a specific prefix, not only show ip bgp summary. Verify it is received or originated, inspect policy matches, compare the attributes of all candidates, identify the BGP best path, then check RIB installation and recursive forwarding. If the peer is Established but the prefix is missing, troubleshoot advertisement/policy rather than resetting the session blindly.
Evidence · 4 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
The official Cisco source documents this command in a bounded Cisco product/release or feature context.
other · Evidence referenceCisco source context for show bgp ipv4 unicast neighbors <neighbor>The official Cisco source documents this command in a bounded Cisco product/release or feature context.
other · Evidence referenceCisco source context for show bgp ipv4 unicast neighbors <peer> advertised-routesThe official Cisco source documents this command in a bounded Cisco product/release or feature context.
other · Evidence referenceCisco source context for show bgp ipv4 unicast neighbors <peer> received-routesThe official Cisco source documents this command in a bounded Cisco product/release or feature context.
Subtopics
Go one level deeper into this subject.
BGP Path Attributes Reference is an operational deep-reference Topic for path-attribute interpretation across Weight, LOCAL_PREF, locally originated state, AS_PATH, Origin, MED, eBGP/iBGP context and next-hop reachability without confusing one attribute with the complete best-path decision. Supplements its older compact reference sections with explicit state ownership, verification, failure signatures and closure proof.
Subtopic BGP Best-Path ReferenceBGP selects one or more best paths from valid candidates using ordered policy and path attributes, then offers the result to the RIB.
Subtopic Best PathBest Path is treated as a specific BGP operational boundary. This reference documents ordered BGP path selection among eligible candidates rather than a single-attribute decision such as shortest AS_PATH with explicit state ownership, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic AS_PATHAS_PATH is treated as a specific BGP eBGP operational boundary. This reference documents AS_PATH as both inter-AS loop-prevention state and a policy-visible path attribute whose sequence length and manipulation can influence best-path selection with explicit protocol state, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic NEXT_HOPNEXT_HOP is treated as a specific BGP operational boundary. This reference documents the BGP NEXT_HOP attribute and its recursive reachability dependency between learned control-plane paths and usable forwarding with explicit state ownership, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic LOCAL_PREFLOCAL_PREF is treated as a specific BGP eBGP operational boundary. This reference documents LOCAL_PREF as an AS-internal outbound-exit preference, normally propagated to iBGP peers and evaluated with higher values preferred before AS_PATH/MED decisions with explicit protocol state, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic MEDMED is treated as a specific BGP eBGP operational boundary. This reference documents the Multi-Exit Discriminator as a neighboring-AS ingress hint, with lower values generally preferred where comparison rules make the candidates eligible to be compared with explicit protocol state, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic WeightWeight is treated as a specific BGP eBGP operational boundary. This reference documents Cisco-local BGP Weight as a non-advertised per-router preference, with higher values preferred and no automatic consistency across other routers in the AS with explicit protocol state, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic OriginOrigin is treated as a specific BGP eBGP operational boundary. This reference documents the BGP ORIGIN attribute and its IGP, EGP and incomplete codes, including how route origination method influences the attribute without describing the underlying IGP protocol itself with explicit protocol state, verification, failure signatures and closure proof instead of relying on generic parent text.
BGP selects among paths using attributes and reachability, not simply the numerically shortest network path. In Cisco-oriented study, reason through locally significant attributes such as weight/local preference, locally originated paths, AS-path length, origin, MED and eBGP/iBGP distinctions before later tie-breakers.
Always verify that the BGP next hop is reachable in the relevant routing table. A 'best' path that cannot resolve a next hop does not provide usable forwarding.
show ip route— Display IPv4 routing table. Proves which routes are installed in the local RIB and exposes prefix, source, next hop, AD/metric and default-route state.show ip cef— Inspect FIB/CEF forwarding entries. Shows FIB/CEF forwarding entries and how a destination prefix resolves toward an interface/next hop.show ip bgp summary— Check BGP neighbor session state and prefix counts. Shows BGP peer session state, peer AS, uptime and prefix-count/state summary for an address family.show ip bgp— Inspect BGP paths and attributes. Shows BGP candidate paths, next hop and path attributes and identifies the locally selected best BGP path.- Symptom: The expected prefix appears in BGP output, yet forwarding does not reach the destination. → BGP path selected but traffic still fails
ReferenceWhat it is1 section · depth on demand
Concept overview
When BGP learns more than one valid path to the same prefix, it must choose one to use and advertise. Unlike an IGP it does not pick the lowest cost: it compares path attributes in a fixed order — Weight, LOCAL_PREF, local origination, AS_PATH length, ORIGIN, MED, eBGP over iBGP, IGP metric to the next hop, then tie-breakers — and stops at the first difference.
That order is what makes BGP a policy protocol. Operators steer traffic by setting the earliest attribute whose scope fits the goal: LOCAL_PREF to choose the exit for the whole AS, Weight to override one router, AS_PATH prepending or MED to ask a neighbour to prefer a particular entry.
The child Topics go deeper: Best Path for the full decision order and troubleshooting, BGP Best-Path Reference for a three-router lab, and one Topic per attribute.
ReferenceHow it works2 sections · depth on demand
How it works
For every prefix BGP keeps all received paths in its table, marks the valid ones, and runs the decision process whenever a path is added, withdrawn or changes. The winner gets the > (best) marker in show ip bgp and is offered to the routing table and advertised to peers (subject to outbound policy). Losing paths stay in the BGP table as backups, which is why failover is fast when the best path disappears: the next candidate is already there.
Policy pipeline before best-path selection
BGP learning is a pipeline: the peer session must be established, a prefix must be received/originated, inbound policy decides whether it is accepted and can modify attributes, best-path selection compares eligible paths, and only then can the selected BGP path compete for RIB installation.
Attributes have different scope and intent. Weight is Cisco-local, Local Preference influences outbound choice across an AS, AS_PATH expresses path history/loop prevention and can influence preference, MED is a hint between neighboring ASes under defined comparison rules, and next-hop reachability remains mandatory for practical forwarding.
ReferenceImportant terms & boundaries4 sections · depth on demand
Important terms and limits
Important terms: neighbor, remote AS, address family, NLRI/prefix, next hop, Weight, Local Preference, AS_PATH, origin, MED, eBGP/iBGP, best path, RIB and recursive next hop.
In depth
Cisco's BGP best-path algorithm
When BGP has several paths to the same prefix, Cisco IOS compares them in a fixed order and stops at the first difference. Cisco's best-path document lists the steps:
1. Highest weight (Cisco-only, local to the router).
2. Highest LOCAL_PREF (default 100).
3. Locally originated, preferring network or redistribution over aggregates. AIGP is also considered here when configured.
4. Shortest AS_PATH (an AS_SET counts as one).
5. Lowest origin (IGP before EGP before incomplete).
6. Lowest MED, compared only between paths from the same neighbouring AS.
7. eBGP over iBGP.
8. Lowest IGP metric to the next hop.
9. Multipath decision.
10. Oldest eBGP path.
11. Lowest router ID (the ORIGINATOR_ID for reflected routes).
12. Shortest cluster list.
13. Lowest neighbour address.
Options that change the algorithm (document)
| Command | Effect |
|---|---|
bgp always-compare-med | Compare MED between paths from different ASes; must be consistent across the AS |
bgp deterministic-med | Group paths by neighbouring AS before comparing MED |
bgp bestpath as-path ignore | Skip the AS_PATH length step |
bgp bestpath compare-routerid | Skip the "oldest path" step and use the router ID |
bgp default local-preference <n> | Change the default LOCAL_PREF |
Finding the deciding step
Compare the best path and the runner-up one attribute at a time, in the algorithm's order. The first attribute that differs explains the choice.
| Best path | Runner-up | Deciding step |
|---|---|---|
| localpref 200 | localpref 100 | 2 (LOCAL_PREF) |
| AS_PATH 64500 | AS_PATH 64501 64502 | 4 (AS_PATH length) |
| external | internal | 7 (eBGP over iBGP) |
| metric to next hop 11 | metric 21 | 8 (IGP metric) |
| Received first | Received later, both eBGP | 10 (oldest path) |
R1# show bgp ipv4 unicast 192.0.2.0/24
BGP routing table entry for 192.0.2.0/24, version 8211
Paths: (3 available, best #2, table default)
64501 64496
198.51.100.9 from 198.51.100.9 (198.51.100.9)
Origin IGP, metric 0, localpref 100, valid, external
64500 64496
203.0.113.1 from 203.0.113.1 (203.0.113.1)
Origin IGP, metric 0, localpref 100, valid, external, best
64500 64496
10.255.0.2 (metric 11) from 10.255.0.2 (10.255.0.2)
Origin IGP, metric 0, localpref 100, valid, internal
R1# show bgp ipv4 unicast 192.0.2.0/24 bestpath
Reading the example
All three paths have equal LOCAL_PREF, AS_PATH length and origin. The internal path loses at step 7 (eBGP over iBGP). Between the two external paths, the MEDs aren't compared because they come from different ASes, so step 10 picks the older path. That is usually the one received first.
Documented example, not captured output.
Quick reference
BGP path selection compares all valid paths for a prefix step by step and stops at the first difference. Before the comparison, a path must be valid: its NEXT_HOP must be reachable, it must pass inbound policy and must not contain the local AS.
| Order | Attribute | Preference |
|---|---|---|
| 1 | Weight (Cisco, local) | Highest |
| 2 | LOCAL_PREF | Highest |
| 3 | Locally originated | Preferred |
| 4 | AS_PATH length | Shortest |
| 5 | ORIGIN | IGP < EGP < incomplete |
| 6 | MED | Lowest (same neighbor AS by default) |
| 7 | eBGP over iBGP | eBGP |
| 8 | IGP metric to NEXT_HOP | Lowest |
| 9+ | Oldest eBGP path, lowest router ID, shortest CLUSTER_LIST, lowest neighbor address | Tie-breakers |
AIGP (when enabled) sits between local origination and AS_PATH; see Best Path for the complete Cisco order with notes.
show bgp ipv4 unicast 203.0.113.0/24
Documented example, not captured output.
Use LOCAL_PREF to steer outbound traffic and AS_PATH prepending or MED to influence inbound traffic.
Best path is not the same as forwarding path
show ip bgp <prefix> can identify the best BGP candidate. The RIB can still prefer another protocol for the same prefix because of administrative distance, and CEF still must recursively resolve the selected RIB next hop. This is why BGP Established → BGP best → RIB → CEF should be treated as separate evidence boundaries.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Lab addressing; local AS 65000; both eBGP neighbours Established; route-refresh supported.
route-map FROM-PRIMARY permit 10
set local-preference 200
route-map TO-BACKUP permit 10
set as-path prepend 65000 65000
!
router bgp 65000
address-family ipv4 unicast
neighbor 192.0.2.2 route-map FROM-PRIMARY in
neighbor 192.0.2.6 route-map TO-BACKUP out
!
! then: clear ip bgp * softExpected output
show ip bgpExpected state: One path per prefix carries `>`; the attribute columns explain why.
Network Next Hop Metric LocPrf Weight Path
*> 203.0.113.0/24 192.0.2.2 0 200 0 65010 65030 i
* 192.0.2.6 0 0 65020 i
! Illustrative output, not captured Evidence.`*` = valid, `>` = best. The first path wins on LocPrf 200 (a blank LocPrf on an eBGP path means the default 100) even though its AS_PATH is longer. The trailing `i` is ORIGIN IGP, not iBGP.Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in BGP → BGP Path Selection. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc4271.html · confidence 94%Commands commonly referenced together
Compact reference collections only; they are not a guided troubleshooting workflow.
Session → prefix → RIB → forwarding
Use when a BGP peer or one exact prefix is in question.Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
BGP Local Preference is a well-known discretionary attribute used inside an AS to prefer an outbound path; higher is better.
BGP · primaryMEDThe Multi-Exit Discriminator is a BGP attribute that suggests a preferred entry point into an AS; lower is better when MEDs are compared.
BGP · relatedAS PathAS_PATH is the ordered list of autonomous systems a BGP advertisement has traversed. It supports loop prevention and influences best-path selection.
BGP · relatedLocal PreferenceLocal Preference is a BGP path attribute used inside an autonomous system to express which exit is preferred for outbound traffic. Higher Local Preference wins before AS_PATH length in the normal decision sequence.
BGP · relatedMEDMED is a BGP attribute used to suggest a preferred ingress into an AS when multiple links exist between neighboring autonomous systems. Lower MED is preferred when MED is compared.
Routing · relatedRIBRouting Information Base: the routing table of routes selected for installation.
Quick lookup tables
BGP path-selection factors
Common IOS/IOS XE path-selection factors used when comparing eligible BGP paths.
| Factor | Typical preference | Boundary |
|---|---|---|
| Weight | Higher | Local to one Cisco router |
| Local Preference | Higher | Propagated inside the AS; common outbound-exit policy |
| Locally originated | Preferred | Local origination can outrank learned alternatives |
| AS_PATH | Shorter | Only after higher-priority factors are equal |
| Origin | IGP < EGP < incomplete | One later comparison factor |
| MED | Lower | Comparison rules/context matter |
| eBGP vs iBGP | eBGP preferred | Later than the attributes above |
| IGP metric to next hop | Lower | Requires usable next-hop reachability |
BGP session states
Fast FSM reference when the peer is not Established.
| State | Meaning | Useful next boundary |
|---|---|---|
| Idle | Initial/restart state; no established transport | Neighbor config, routing and TCP prerequisites |
| Connect | Waiting for TCP connection result | IP/TCP reachability to peer |
| Active | TCP/session establishment is retrying | Reachability, ACL/firewall, update-source, peer address/AS |
| OpenSent | OPEN sent; waiting/processing peer OPEN | AS number, capabilities, authentication/context |
| OpenConfirm | OPEN accepted; keepalive confirmation pending | Session stability / keepalive exchange |
| Established | BGP messages and NLRI can be exchanged | Exact prefix → policy → best path → RIB → CEF |
Operational notes
Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.
BGP command cheat sheet
Session → prefix → RIB → forwarding
1. show ip bgp summary — session state only.
2. show ip bgp <prefix> — candidate paths, attributes and best path.
3. show ip route <prefix> — whether a route is installed in the RIB.
4. show ip cef <destination> — recursive forwarding state.
Established does not prove that the required prefix exists or forwards.
BGP neighbor config skeleton
Basic eBGP peer reference with explicit verification
router bgp 65000
neighbor 192.0.2.2 remote-as 65001
Then prove IP/TCP reachability and inspect show ip bgp summary. An Established session still does not prove the required prefix is present, selected or forwardable.
BGP Attributes Fast Check
Scope og operational meaning for common best-path attributes.
| Attribute | Practical scope | Typical effect |
|---|---|---|
| Weight | One Cisco router | Higher preferred |
| Local Preference | Inside AS | Higher preferred |
| AS_PATH | Inter-AS path history | Shorter often preferred later in decision chain |
| Origin | Path metadata | IGP before EGP before incomplete |
| MED | Hint to neighboring AS | Lower often preferred in eligible comparison |
| Next hop | Reachability dependency | Must resolve before useful forwarding |
Husk
Never troubleshoot one attribute without confirming policy, eligibility, next-hop resolution, RIB and CEF.
Deep reference
Healthy vs suspicious evidence
How to read the evidence
Anchor the same prefix/neighbor across protocol input, policy/selection, RIB and forwarding state before testing packets. Verification: Verify the same prefix at received, accepted, best-path, RIB and FIB layers; then verify next-hop resolution and the actual forwarding flow instead of relying on Established alone.
Design & tradeoffs
ENCOR design tradeoffs
Choose policy attributes based on scope: local preference influences outbound exit across an AS; AS-path prepending commonly influences external inbound preference.