Use it to read BGP output correctly and to see which attribute decided between two paths.
BGP Core Attribute Field Reference
Six attributes do most of the work in BGP: ORIGIN, AS_PATH, NEXT_HOP, MED, LOCAL_PREF and COMMUNITIES. They appear as the Next Hop, Metric, LocPrf and Path columns of show ip bgp; communities only in the per-prefix view.
1. show ip bgp <prefix> — list the paths; which is best?
2. Next hop reachable on each? If not, that path is out.
3. Compare weight, then local preference, then AS path length, origin, MED.
4. The first difference is the reason.
5. A policy should have set something → is the value there?
path received → next hop reachable (valid) → weight → LOCAL_PREF → locally originated → AS_PATH length → ORIGIN → MED (same neighbouring AS) → eBGP over iBGP → IGP cost to next hop
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
show ip bgpVerification & 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.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational verification Verify boundary
show ip bgp
show ip bgp 203.0.113.0/24
show ip bgp neighbors 192.0.2.2 routes
The table view gives one line per path with the columns above. The prefix detail spells every attribute out for each path — AS path, next hop and whether it is reachable, origin, metric, localpref, weight, communities — and marks one path as best; newer releases also print the reason other paths lost. The neighbour view limits the table to one neighbour's routes.
Known-good: the best path is the intended one, and each attribute a policy is supposed to set shows the intended value on the intended paths.
Step 2 Failure isolation workflow Narrow the fault
- A blank LocPrf is read as zero. It means the default of 100 applies.
- A blank Metric is read as "no preference". A missing MED counts as 0 and wins over any explicit value.
- MED is set but ignored. The competing paths come from different neighbouring ASes, or an earlier criterion — weight, LOCAL_PREF, AS path length — already decided.
- A redistributed route loses to a
networkroute with identical attributes. Origin?is less preferred thani. - A path with better attributes is not chosen. Its next hop is unreachable, so it lacks the valid flag.
- Weight explains a choice that the attributes do not. A locally originated route has weight 32768 and beats any learned path.
- Communities are looked for in the table view. They appear only in the per-prefix detail.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
A blank LocPrf means the default 100, not zero. A blank Metric means no MED, which counts as 0 — the best value. The last character of Path is the origin (i beats ?). Weight is local to the router and is compared first; 32768 marks a route this router originated.
show ip bgp— one line per path: status flags, next hop, metric, local preference, weight, path.show ip bgp <prefix>— every attribute spelled out per path, the best path, communities.show ip bgp neighbors <ip> routes— one neighbour's paths.
ReferenceWhat it is1 section · depth on demand
Mechanics & mental model
A handful of path attributes do most of the work in BGP: ORIGIN, AS_PATH, NEXT_HOP, MED, LOCAL_PREF and COMMUNITIES. This topic describes what each one contains and how it appears in the columns and lines of show ip bgp.
ReferenceWhy it matters1 section · depth on demand
Why it matters operationally
Reading BGP output means reading these attributes. The summary table packs them into a few terse columns, some of which are blank when a default applies, and misreading a blank or a zero leads to wrong conclusions about why a path was chosen.
ReferenceHow it works1 section · depth on demand
How it works
| Attribute | Type code | Value | Shown in show ip bgp as |
|---|---|---|---|
| ORIGIN | 1 | How the route entered BGP: 0 IGP, 1 EGP, 2 incomplete | The last character of the Path column: i, e or ? |
| AS_PATH | 2 | The list of AS numbers the route has passed | The Path column |
| NEXT_HOP | 3 | The address to send traffic to | The Next Hop column |
| MED | 4 | A 32-bit number suggested by the neighbouring AS; lower is preferred | The Metric column |
| LOCAL_PREF | 5 | A 32-bit number valid inside the AS; higher is preferred | The LocPrf column |
| COMMUNITIES | 8 | A list of 32-bit tags | Only in the detailed view, show ip bgp <prefix> |
A typical line:
Network Next Hop Metric LocPrf Weight Path
*> 203.0.113.0/24 192.0.2.2 0 150 0 65010 65020 i
Reading the columns.
- Path
65010 65020 i— received from AS 65010, originated in AS 65020, origin IGP. An empty path with onlyior?is a route originated in the local AS. - Origin
imeans the route was put into BGP with anetworkstatement;?means it was redistributed.iis preferred over?. - Metric is the MED. A blank means the neighbour sent none, which Cisco treats as 0 — the best possible value — unless
bgp bestpath med missing-as-worstis configured. - LocPrf is blank for routes learned from eBGP neighbours where no policy set it; they are treated as having the default, 100. Routes from iBGP neighbours show the value that was sent.
- Weight is not an attribute at all but a local value on Cisco routers: 32768 for routes the router originated itself, 0 for others unless set. It is compared before anything else.
- Next Hop
0.0.0.0means the route was originated on this router. - The status flags at the left:
*valid,>best,ilearned from iBGP,rnot installed in the routing table,ssuppressed.
MED is compared only between paths received from the same neighbouring AS, unless bgp always-compare-med is set.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
The core path attributes
A small set of attributes drives most BGP decisions. RFC 4271 defines them:
- ORIGIN (type 1): 0 IGP, 1 EGP, 2 INCOMPLETE.
- AS_PATH (type 2): AS_SEQUENCE and AS_SET segments.
- NEXT_HOP (type 3): the address to forward to.
- MULTI_EXIT_DISC (type 4): optional non-transitive, compared between paths from the same neighbouring AS.
- LOCAL_PREF (type 5): sent to iBGP peers only.
- ATOMIC_AGGREGATE (type 6) and AGGREGATOR (type 7): describe aggregation.
COMMUNITIES (type 8) comes from RFC 1997.
Attributes and their role in best-path selection
| Attribute | Category | Scope | Preferred value |
|---|---|---|---|
| LOCAL_PREF | Well-known discretionary | Within the AS (iBGP) | Higher |
| AS_PATH | Well-known mandatory | Global | Shorter |
| ORIGIN | Well-known mandatory | Global | IGP < EGP < INCOMPLETE |
| MED | Optional non-transitive | Between neighbouring ASes | Lower |
| NEXT_HOP | Well-known mandatory | Next-hop reachability required | Lower IGP metric to it |
| COMMUNITIES | Optional transitive | Global, policy tags | Not compared |
NEXT_HOP behaviour
| Session | NEXT_HOP sent |
|---|---|
| eBGP | Usually the sending router's own address |
| iBGP | Unchanged by default: the eBGP neighbour's address |
iBGP with next-hop-self | The sending router's address |
If an iBGP peer can't reach the NEXT_HOP through its IGP, the route is unusable. That is a common cause of "BGP route not installed".
R1# show bgp ipv4 unicast 192.0.2.0/24
BGP routing table entry for 192.0.2.0/24, version 8211
Paths: (2 available, best #1, table default)
64500 64496
203.0.113.2 from 203.0.113.2 (203.0.113.2)
Origin IGP, metric 20, localpref 200, valid, external, best
Community: 65010:100
64501 64502 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(config-router-af)# neighbor 10.255.0.2 next-hop-self
R1(config-router-af)# neighbor 10.255.0.2 send-community both
In this example path 1 wins on LOCAL_PREF (200 against 100) before AS_PATH length is even compared.
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
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 Network & Protocols → BGP Core Attribute Field Reference. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc4271.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
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.
Operational notes
Former standalone Cheat Sheet content now lives directly inside the Topic where it belongs.
BGP Core Attribute Evidence
Fast path-attribute comparison.
Compare next-hop validity, Weight (Cisco), Local Preference, AS_PATH, Origin, MED and communities. Separate received values from post-policy local values.