Glossary · networking-protocols · 8 min
What is BGP and how does it work?
Every time you load a webpage hosted in a different country, the route your packets take is determined by BGP. The Border Gateway Protocol is the glue that holds the internet together — connecting tens of thousands of autonomous systems (AS) operated by ISPs, content providers, enterprises, and cloud providers. Unlike interior protocols like OSPF or EIGRP that optimize for speed within an organization, BGP optimizes for policy: which routes to advertise to whom, which routes to accept, and how to influence path selection.
What is BGP — the technical definition
BGP is a path-vector routing protocol standardized in RFC 4271 (BGP-4). It runs over TCP port 179 and exchanges complete AS_PATH information rather than just metric values. This is the key difference from OSPF (link-state) and EIGRP (advanced distance-vector): BGP routers know the complete sequence of autonomous systems a route traverses, which allows fine-grained policy control and natural loop prevention. The protocol's two operating modes — eBGP (between different AS) and iBGP (within the same AS) — have different rules about route advertisement, next-hop behavior, and split-horizon.
How BGP works — the message types
BGP peers establish a TCP session, then exchange four message types: OPEN (initial handshake with AS number, hold time, capabilities), KEEPALIVE (every 60 seconds by default to maintain the session), UPDATE (carrying NLRI with path attributes when routes change), and NOTIFICATION (error or session teardown). Once peers reach Established state, they exchange a full table dump, then only incremental updates. A typical full BGP table on the public internet is currently around 950,000 IPv4 routes and 200,000 IPv6 routes — running BGP at scale requires careful memory and CPU planning.
BGP path attributes — how route preference is decided
BGP doesn't use a single metric. It uses path attributes evaluated in a strict order: 1) Highest WEIGHT (Cisco-only, local preference), 2) Highest LOCAL_PREF (organization-wide policy), 3) Locally-originated routes prefer (network/aggregate over learned), 4) Shortest AS_PATH, 5) Lowest ORIGIN code (IGP < EGP < incomplete), 6) Lowest MED (sent from neighbor AS), 7) eBGP over iBGP, 8) Lowest IGP cost to next-hop, 9) Oldest route, 10) Lowest router ID. Memorizing this exact order is critical for the CCNP ENCOR and CCIE Security/Enterprise exams.
iBGP vs eBGP — same protocol, different rules
eBGP runs between different autonomous systems with TTL=1 by default (multihop config required for non-directly-connected peers). It modifies AS_PATH (prepends own AS) and changes next-hop to self. iBGP runs within the same AS, requires full mesh peering by default (or route reflectors / confederations as workaround), does NOT modify AS_PATH, and does NOT change next-hop. The full-mesh requirement is why route reflectors became essential — in a 100-router AS, full mesh = 4,950 sessions; a route reflector design might need 100.
Common BGP issues and how to troubleshoot them
Production BGP problems usually fall into 4 buckets: (1) Session won't establish — check TCP 179 reachability, AS number match, peer IP, MD5 password if configured. (2) Routes received but not installed — usually next-hop unreachable; verify the IGP has a route to the BGP next-hop. (3) Routes advertised but neighbor not seeing them — check route-maps, prefix-lists, AS_PATH access lists. (4) Path selection unexpected — walk the 10-step path attribute list with
show ip bgp <prefix>. At Networkers Home's CCIE labs, students debug all four scenarios on real hardware before the certification exam.Exam relevance
Networkers Home students train BGP on real Cisco hardware (ISR / ASR routers) at the HSR Layout Sector 6 lab. Founder Vikas Swami (Dual CCIE #22239 — Routing & Switching plus Security) personally teaches the advanced BGP path-selection and route-reflector design modules. For the modern overlay-routing era beyond classical BGP, Vikas also ships QuickSDWAN — the first AI-managed SD-WAN platform with Claude + Groq LLaMA control plane managing 5,000+ nodes — and MeshWG for router-native WireGuard mesh on 57 supported routers (₹349/machine/month).
BGP is a CCNP- and CCIE-level deep-dive. Start with the basics in our CCNA programme in Bangalore, then progress to CCNP / CCIE in the same lab.
Frequently asked questions
What is BGP used for in simple terms? +
BGP is the routing protocol that lets the internet's autonomous systems share routing information with each other. When you visit a website hosted in another country, BGP decides the path your packets take across multiple ISPs to reach the destination. It's also used inside large enterprises (as iBGP) to exchange routes between sites without flooding all of them through OSPF or EIGRP.
Is BGP a Layer 3 or Layer 4 protocol? +
BGP operates at Layer 7 of the OSI model (application layer) — it runs OVER TCP, which is at Layer 4. The routes BGP advertises ARE Layer 3 (IPv4 / IPv6 prefixes), but the protocol itself is an application running on TCP port 179. This trips up many CCNA candidates because most other routing protocols are at Layer 3 directly (OSPF, EIGRP, IS-IS).
How long does it take to learn BGP for the CCNP exam? +
Most students at Networkers Home spend 3-4 weeks on BGP within the larger CCNP Enterprise (300-401 ENCOR + 300-410 ENARSI) curriculum. The conceptual model takes a week; configuration practice takes another week; deep troubleshooting and exam-pattern memorization (path attribute ordering, route reflector behavior, communities, regex on AS_PATH) takes 1-2 weeks more. Hands-on time on real Cisco hardware is what separates students who pass first attempt from those who don't.
What's the difference between iBGP and eBGP? +
eBGP runs between BGP peers in different autonomous systems and is what makes the public internet work. iBGP runs between BGP peers in the same AS and is used to carry external routes across an enterprise without redistributing them into OSPF/EIGRP. The four key behavioral differences: TTL (eBGP=1, iBGP=255), AS_PATH (eBGP modifies, iBGP doesn't), next-hop-self (eBGP yes, iBGP no by default), and split-horizon (iBGP requires full mesh or route reflectors).
What are BGP communities and why do they matter? +
BGP communities are 32-bit tags attached to routes that act as policy signals between BGP peers. Common uses: NO_EXPORT (don't advertise this route to eBGP neighbors), NO_ADVERTISE (don't advertise to anyone), and well-known per-ISP communities like 'set local-preference to 200' or 'don't announce in Asia'. ISPs publish their community lists; understanding them is the difference between a junior network engineer who configures by trial-and-error and a senior one who designs policy-driven routing.