Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

BGP (Border Gateway Protocol)

Direct answer

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.

When to use this

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.

First 30 seconds

Start with one prefix and one peer: prove session state, received candidate paths, best-path selection, RIB installation and next-hop forwarding in order.

Operational verification

peer reachable from the peering source → session Established → prefix received → valid and best path → routing table → CEF → traffic and return path

Evidence · next step

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
Common mistakes
Common mistakes
  • 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 network statement 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.
Platform / version applicability
Protocol standard + deployed implementation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformProtocol standard · Cisco IOS XE · IOS/IOS XE
Scope / prerequisiteUse BGP when routing policy, autonomous-system boundaries and controlled path selection matter more than a single short…
What next?3 suggested next steps
Child topics (this level)5
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

6 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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.

Step 6 Branching troubleshooting Narrow the fault

Path: Networking → Routing → BGP. Local intent: BGP reference for peer session state, NLRI/policy processing, path attributes, best-path selection and the separation between BGP RIB, global RIB and forwarding.

Evidence references

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.

command output · 1
Command lookup Jump straight to Cisco syntax
Drill down

Subtopics

Go one level deeper into this subject.

Subtopic BGP Fundamentals

BGP transport, AS identity, neighbor state and the received-path → best-path → RIB → forwarding boundaries.

Subtopic eBGP

eBGP 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 Reference

iBGP 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 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.

Subtopic BGP Communities Deep Reference

BGP 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.

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 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.
Key checks

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

ItemDetail
TransportTCP, port 179
Private AS range64512–65535
eBGPPeers in different ASes; by default only directly connected neighbours
iBGPPeers in the same AS; need not be directly connected if the IGP reaches them
iBGP full meshRequired, unless route reflectors or confederations are used
TimersKeepalive 60 s, hold time 180 s
Administrative distanceExternal 20, internal 200, local 200
ECMPmaximum-paths; hardware maximum 8 on Catalyst 9300
LicensingNetwork 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
PurposeFast routing inside one organisationPolicy-based routing between organisations
MetricCost or composite metricPath attributes compared in a fixed order
ScaleThousands of routesThe full Internet table (about a million IPv4 routes)
NeighboursDiscovered automaticallyConfigured 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Best path and layer-by-layer checks

A separate check for each layer

LayerQuestionCommand
SessionIs the neighbour Established?show bgp ipv4 unicast summary
ReceivedWhat did the neighbour send?... neighbors <ip> received-routes or routes
PolicyWhat did inbound policy accept or change?show route-map, ... neighbors <ip> routes
Best pathWhich path won, and why?show bgp ipv4 unicast <prefix>
InstallationIs the route in the RIB?show ip route <prefix>, show bgp ... rib-failure
AdvertisementWhat do we send?... neighbors <ip> advertised-routes

Best-path order on Cisco IOS (simplified)

StepPrefer
1Highest weight (Cisco, local only)
2Highest LOCAL_PREF
3Locally originated
4Shortest AS_PATH
5Lowest ORIGIN (IGP < EGP < incomplete)
6Lowest MED (same neighbouring AS)
7eBGP over iBGP
8Lowest IGP metric to the NEXT_HOP
9Oldest 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Configuration example

Cisco IOS / IOS XE RFC 4271Minimal eBGP: one neighbour and one advertised prefix

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.0

Expected output

Cisco IOS / IOS XE RFC 4271show ip bgp summary

Expected 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.
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docProtocol standard + deployed implementation RFC 4271

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%
2026-09-13 · vendor docCisco IOS XE current

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%
Embedded reference data

Quick lookup tables

BGP troubleshooting flow

Evidence-first order for one peer and one prefix

StepBoundaryPrimary evidence
1Peer IP/source reachable?route/ping with intended source
2TCP/179 works?summary/neighbor + packet evidence if needed
3FSM Established?show ip bgp summary
4Exact prefix exists in BGP?show ip bgp / show bgp ipv4 unicast
5Expected path is best?candidate attributes + best marker
6Best path is in RIB?show ip route bgp
7Traffic still fails?CEF/adjacency/ACL/NAT/return path

BGP · operational reference

Compact state and interpretation boundaries for fast lookup.

BGP layerCanonical questionEvidence
SessionIs peer Established?show ip bgp summary
PrefixIs exact NLRI present/accepted?show ip bgp <prefix>
Best pathWhich candidate won BGP?best-path marker/attributes
RIB/FIBIs selected route installed/forwardable?show ip route / show ip cef
Confirmation

Confirm action

Continue?