Use BGP when routing policy, autonomous-system boundaries and controlled path selection matter more than a single shortest-path metric. Troubleshoot one peer and one prefix at a time.
BGP (Border Gateway Protocol)
Border Gateway Protocol (BGP) is a path-vector interdomain routing protocol. It exchanges network reachability plus path attributes over a TCP session instead of discovering shortest paths from a shared topology database.
Start with one prefix and one peer: prove session state, received candidate paths, best-path selection, RIB installation and next-hop forwarding in order.
peer reachable from the peering source → session Established → prefix received → valid and best path → routing table → CEF → traffic and return path
Inspect CEF/adjacency and then follow the exact flow through policy and return-path boundaries.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
- Reading Established as evidence that the required prefix is usable.
- Comparing AS_PATH before checking Weight or LOCAL_PREF.
- Treating MED as globally comparable in every design.
- Forgetting that the
networkstatement requires a matching RIB route. - Changing policy before proving whether the prefix is absent, non-best or not installed.
- Hard-resetting a healthy peer when a soft policy refresh is sufficient and supported.
Operational reference
Fast context before you go deeper.
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.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 First 30 seconds Verify boundary
Immediate answer: Start with one prefix and one peer: show session state, received candidate paths, best-path selection, RIB installation and next-hop forwarding in order.
Verification chain: transport/session → received UPDATEs → policy/attributes → best path → RIB → recursive next hop/CEF → service test
Stop condition: An Established BGP session is only the transport/control boundary, but it does not show the required prefix is received, selected or forwardable.
Step 2 Verification path Verify boundary
Primary bounded procedure: Use show ip bgp summary for session scope, then inspect the exact prefix and advertisement/policy state before checking the forwarding path.
Step 3 Verification and output interpretation Verify boundary
Start with show ip bgp summary for peer state, uptime and broad prefix counts, then move to an exact prefix with show ip bgp <prefix> or equivalent canonical BGP-table view. For that prefix identify received/valid paths, policy-relevant attributes, best-path marker and NEXT_HOP. Next use show ip route <prefix> to show whether the selected BGP path installed in the RIB, and show ip cef <prefix> when forwarding state matters. For outbound behavior, inspect advertised-routes or policy effects for the specific neighbor rather than inferring advertisement from the local table. A robust reference check follows one peer and one prefix through the complete state chain.
Step 4 Step-by-step troubleshooting Narrow the fault
1. Capture the current local state before changing configuration.
2. Walk this chain: transport/session → received UPDATEs → policy/attributes → best path → RIB → recursive next hop/CEF → service test.
3. Stop at the first step not supported by evidence.
4. Change one thing only when the failing step is understood.
5. Repeat the original test and check adjacent working paths for regression.
Boundary rule: An Established BGP session is only the transport/control boundary, but it does not show the required prefix is received, selected or forwardable.
Step 5 Verification & troubleshooting Narrow the fault
1. Show IP reachability to the peer with the intended source.
2. Check BGP session state.
3. Check whether the exact prefix is present.
4. Compare path attributes and the selected best path.
5. Verify BGP route installation in the RIB.
6. Continue to CEF/adjacency, policy and return-path evidence if traffic still fails.
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.
Subtopics
Go one level deeper into this subject.
BGP transport, AS identity, neighbor state and the received-path → best-path → RIB → forwarding boundaries.
Subtopic eBGPeBGP is treated as a specific BGP operational boundary. This reference documents external BGP peering between autonomous systems, from TCP/session establishment through policy-controlled NLRI exchange and forwarding with explicit state ownership, verification, failure signatures and closure proof instead of relying on generic parent text.
Subtopic iBGP vs eBGP Deep ReferenceiBGP vs eBGP Deep Reference is an operational deep-reference Topic for the different propagation and path-handling rules of iBGP and eBGP, including ASN relationship, next-hop behavior, AS_PATH handling, iBGP full-mesh pressure and the rule that ordinary iBGP-learned routes are not simply re-advertised to another iBGP peer. Supplements its older compact reference sections with explicit state ownership, verification, failure signatures and closure proof.
Subtopic BGP Path SelectionBGP 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.
Subtopic BGP Communities Deep ReferenceBGP Communities Deep Reference is an operational deep-reference Topic for BGP communities as policy metadata carried with routes, including standard/well-known community handling, match/set policy, propagation to neighbors and the distinction between marking a route and proving the intended import/export action occurred. Supplements its older compact reference sections with explicit state ownership, verification, failure signatures and closure proof.
- BGP uses TCP port 179
- The session, prefix, best path, RIB installation and forwarding plane are separate evidence boundaries
- BGP policy changes what is accepted, advertised and preferred
- An Established peer proves message exchange is possible; it does not prove the required prefix exists or forwards
- Follow BGP Fundamentals, eBGP, iBGP, BGP Path Selection and BGP Communities/Route Policy; common attributes apply across the AS boundary.
1. Prove IP reachability to the peer with the intended source.
2. Check BGP session state.
3. Check whether the exact prefix is present.
4. Compare path attributes and the selected best path.
5. Verify BGP route installation in the RIB.
6. Continue to CEF/adjacency, policy and return-path evidence if traffic still fails.
ReferenceWhat it is2 sections · depth on demand
BGP reference map
BGP reference map: BGP Fundamentals → AS identity, neighbor states and BGP tables; eBGP → existing external-neighbor Topics; iBGP vs eBGP Deep Reference → Neighbor Relationships, Full Mesh, Next-Hop-Self and Route Reflectors; BGP Path Selection → existing AS_PATH, NEXT_HOP, LOCAL_PREF, MED, Weight and Origin; BGP Communities Deep Reference → standard, extended and large communities plus the existing Prefix-List & Route-Map Reference. All existing canonical slugs remain valid.
What it is
Border Gateway Protocol (BGP) is a path-vector interdomain routing protocol. It exchanges network reachability plus path attributes over a TCP session instead of discovering shortest paths from a shared topology database.
BGP separates TCP session establishment, OPEN capability negotiation, Adj-RIB-In receipt, inbound policy, best-path selection, Loc-RIB installation and outbound advertisement.
ReferenceHow it works2 sections · depth on demand
How it works
Sessions. BGP routers do not discover each other. Each neighbour is configured by address and AS number, and the two connect over TCP port 179. A neighbour in another AS is an eBGP neighbour; one in the same AS is iBGP. A session is usable when it reaches the Established state.
router bgp 65001
neighbor 192.0.2.2 remote-as 65002
network 203.0.113.0 mask 255.255.255.0
Routes. Once established, each side sends the routes it wants the other to have, and afterwards only changes. A route consists of a prefix and attributes: the list of ASes it has passed (AS path), the next hop, and values that express preference.
Best path. A router often receives several paths for a prefix. It picks one by comparing attributes in a fixed order — on Cisco routers, in brief: highest weight, highest local preference, locally originated, shortest AS path, lowest origin type, lowest MED, eBGP over iBGP, lowest IGP cost to the next hop. Only the best path is installed and passed on. A path whose next hop is unreachable is not considered at all.
Policy. Almost everything in BGP is adjustable per neighbour and direction: what is accepted, what is advertised, and with which attributes. Local preference steers traffic leaving the AS; AS-path prepending and MED influence traffic entering it.
Inside an AS. A route learned from one iBGP neighbour is not passed to another, so iBGP routers need a full mesh of sessions or route reflectors. iBGP also leaves the next hop unchanged, which is why border routers usually set next-hop-self.
Three separate questions frame any BGP problem: is the session up, is the route received and accepted, and is it chosen and installed.
BGP evidence boundaries
Treat BGP as a chain: transport shows TCP/179, session shows the FSM reached Established, NLRI/policy shows a route entered the BGP decision process, best path shows which BGP candidate won, RIB shows installation, and CEF/return path shows forwarding prerequisites. Never skip from Established directly to application blame.
ReferenceImportant terms & boundaries5 sections · depth on demand
Key points
- BGP uses TCP port 179
- The session, prefix, best path, RIB installation and forwarding plane are separate evidence boundaries
- BGP policy changes what is accepted, advertised and preferred
- An Established peer shows message exchange is possible, but it does not show the required prefix exists or forwards
- The persisted source taxonomy for this branch covers eBGP and common path attributes; this reference does not add an additional iBGP hierarchy outside that source tree.
In depth
BGP: the routing protocol between autonomous systems
The Catalyst 9300 BGP guide describes BGP as an exterior gateway protocol for routing between domains, which guarantees loop-free exchange of routing information between autonomous systems. BGP runs over TCP port 179, and each route carries an AS path and other path attributes, which makes it a path-vector protocol.
Documented basics
| Item | Detail |
|---|---|
| Transport | TCP, port 179 |
| Private AS range | 64512–65535 |
| eBGP | Peers in different ASes; by default only directly connected neighbours |
| iBGP | Peers in the same AS; need not be directly connected if the IGP reaches them |
| iBGP full mesh | Required, unless route reflectors or confederations are used |
| Timers | Keepalive 60 s, hold time 180 s |
| Administrative distance | External 20, internal 200, local 200 |
| ECMP | maximum-paths; hardware maximum 8 on Catalyst 9300 |
| Licensing | Network Advantage |
R1(config)# router bgp 64500
R1(config-router)# bgp router-id 10.0.0.1
R1(config-router)# bgp log-neighbor-changes
R1(config-router)# neighbor 192.0.2.1 remote-as 64510
R1(config-router)# neighbor 10.0.0.2 remote-as 64500
R1(config-router)# neighbor 10.0.0.2 update-source Loopback0
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# network 198.51.100.0 mask 255.255.255.0
R1(config-router-af)# neighbor 192.0.2.1 activate
R1(config-router-af)# neighbor 10.0.0.2 activate
R1(config-router-af)# neighbor 10.0.0.2 next-hop-self
R1# show ip bgp summary
BGP router identifier 10.0.0.1, local AS number 64500
BGP table version is 412, main routing table version 412
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.0.2.1 4 64510 48211 41922 412 0 0 4w2d 921343
192.0.2.5 4 64511 12 14 0 0 0 00:01:12 Active
10.0.0.2 4 64500 88121 88019 412 0 0 4w2d 14
iBGP rules (from the guide)
Routes learned from an iBGP neighbour aren't passed to other iBGP neighbours. That's why iBGP needs a full mesh. With route reflectors, routes from a client are reflected to all clients and non-clients, and routes from non-clients only to clients.
BGP versus IGPs
| IGP (OSPF, EIGRP) | BGP | |
|---|---|---|
| Purpose | Fast routing inside one organisation | Policy-based routing between organisations |
| Metric | Cost or composite metric | Path attributes compared in a fixed order |
| Scale | Thousands of routes | The full Internet table (about a million IPv4 routes) |
| Neighbours | Discovered automatically | Configured explicitly |
Operational notes
The guide notes that after a boot or clear ip bgp, Layer 3 forwarding can be delayed by around 80 seconds while the tables fill. Use clear ip bgp <neighbor> soft for policy changes instead of hard resets.
Documented example, not captured output.
Best path and layer-by-layer checks
A separate check for each layer
| Layer | Question | Command |
|---|---|---|
| Session | Is the neighbour Established? | show bgp ipv4 unicast summary |
| Received | What did the neighbour send? | ... neighbors <ip> received-routes or routes |
| Policy | What did inbound policy accept or change? | show route-map, ... neighbors <ip> routes |
| Best path | Which path won, and why? | show bgp ipv4 unicast <prefix> |
| Installation | Is the route in the RIB? | show ip route <prefix>, show bgp ... rib-failure |
| Advertisement | What do we send? | ... neighbors <ip> advertised-routes |
Best-path order on Cisco IOS (simplified)
| Step | Prefer |
|---|---|
| 1 | Highest weight (Cisco, local only) |
| 2 | Highest LOCAL_PREF |
| 3 | Locally originated |
| 4 | Shortest AS_PATH |
| 5 | Lowest ORIGIN (IGP < EGP < incomplete) |
| 6 | Lowest MED (same neighbouring AS) |
| 7 | eBGP over iBGP |
| 8 | Lowest IGP metric to the NEXT_HOP |
| 9 | Oldest eBGP path, then lowest router ID |
R1# show bgp ipv4 unicast summary | begin Neighbor
R1# show bgp ipv4 unicast 192.0.2.0/24 bestpath
R1# show bgp ipv4 unicast 192.0.2.0/24 | include best|localpref|from
R1# show ip route 192.0.2.0
Read the reason, not just the result
When a path isn't best, compare it with the winning path attribute by attribute, in this order. The first difference explains the choice, and the later steps don't matter.
State model and protocol mechanics
BGP is a policy-oriented path-vector protocol. A neighbor session first depends on IP reachability and TCP port 179, then progresses through the BGP finite-state machine until OPEN parameters are accepted and KEEPALIVE/UPDATE exchange can occur. UPDATE messages carry NLRI and path attributes such as AS_PATH, NEXT_HOP, ORIGIN and optional policy attributes. Received routes are evaluated by inbound policy before entering usable local BGP state. The router can retain multiple paths for a prefix while selecting a best path according to BGP decision logic and local policy. That best path may then be offered to the global RIB, where next-hop reachability and competition with other route sources still matter. Outbound policy separately controls what is advertised to each neighbor.
Limits and common misconceptions
Established shows only that the BGP session reached its operational FSM state, but it does not show any expected NLRI was received, accepted or advertised. A path visible in the BGP table may be valid but non-best, and the best BGP path may still fail RIB installation because its next hop is unresolved or another source wins. Prefix counters are summaries, not evidence about one route. AS_PATH length is only one best-path input and local policy can intentionally dominate it. BGP policy is directional: inbound acceptance and outbound advertisement are separate decisions. Treat peer FSM → received path → policy → best path → RIB → CEF as distinct evidence boundaries.
ReferenceConfiguration & state2 sections · depth on demand
Lifecycle
Separate local device state from peer state and from the traffic consumer.
A route can exist without a resolved adjacency; a trunk can be up while the VLAN is absent; a BGP session can be Established while policy suppresses a prefix; a tunnel can be up while underlay or return-path reachability is broken.
Design and configuration model
Define peers explicitly with the intended remote AS and source/update behavior, then treat address-family activation and route policy as separate configuration concerns. Do not rely on session establishment as a substitute for import/export policy review. Prefix-lists, route-maps and communities should express intentional policy with a default-deny/default-permit model that is understood, not accumulated line-by-line without ownership. NEXT_HOP handling must match the topology, especially across eBGP/iBGP boundaries. Aggregate, default-originate, redistribution and network statements each have different route-origination semantics; choose the mechanism that reflects where the route should come from and under what conditions it may be advertised.
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; loopbacks carried in the IGP.
router bgp 65000
bgp log-neighbor-changes
neighbor 192.0.2.2 remote-as 65010
address-family ipv4 unicast
neighbor 192.0.2.2 activate
network 198.51.100.0 mask 255.255.255.0Expected output
show ip bgp summaryExpected state: Neighbours show a prefix count instead of a state word.
BGP router identifier 1.1.1.1, local AS number 65000
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.0.2.2 4 65010 210 205 42 0 0 03:12:44 12
! Illustrative output, not captured Evidence.The neighbour in AS 65010 has been up for over three hours and has sent 12 prefixes. A word such as `Active` or `Idle` in the last column would mean the session is not Established.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 Routing → BGP. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc4271.html · confidence 94%Official Cisco vendor documentation reviewed for bounded reference claims: BGP sessions, path attributes and routing-table boundaries. This is documentation-based technical verification, not lab or production-runtime proof. Deployment-specific applicability and runtime outcome remain separate evidence.
Basis: https://www.cisco.com/c/en/us/td/docs/routers/ios-xe/ip-routing/b-ip-routing/m_irg-bgp4.html · confidence 94%Quick lookup tables
BGP troubleshooting flow
Evidence-first order for one peer and one prefix
| Step | Boundary | Primary evidence |
|---|---|---|
| 1 | Peer IP/source reachable? | route/ping with intended source |
| 2 | TCP/179 works? | summary/neighbor + packet evidence if needed |
| 3 | FSM Established? | show ip bgp summary |
| 4 | Exact prefix exists in BGP? | show ip bgp / show bgp ipv4 unicast |
| 5 | Expected path is best? | candidate attributes + best marker |
| 6 | Best path is in RIB? | show ip route bgp |
| 7 | Traffic still fails? | CEF/adjacency/ACL/NAT/return path |
BGP · operational reference
Compact state and interpretation boundaries for fast lookup.
| BGP layer | Canonical question | Evidence |
|---|---|---|
| Session | Is peer Established? | show ip bgp summary |
| Prefix | Is exact NLRI present/accepted? | show ip bgp <prefix> |
| Best path | Which candidate won BGP? | best-path marker/attributes |
| RIB/FIB | Is selected route installed/forwardable? | show ip route / show ip cef |