Plain-English Definition
BGP is a routing protocol for networks, not individual devices. Each participating network is an autonomous system with an ASN. That network announces the IP prefixes it can reach, listens to announcements from other networks, and chooses the best path based on policy, AS path length, local preference, and other routing attributes.
A useful way to think about BGP is that it is not a map of roads; it is a set of business and reachability statements between network operators. One ISP may prefer a paid transit provider for some destinations, a private peering link for others, and a backup path only when the primary path disappears. BGP carries those choices across the internet, so routing is shaped by both engineering and policy.
BGP Path Selection Decision Process
When a BGP router receives multiple routes to the same prefix from different peers, it selects one best path through a deterministic sequence of criteria. The order matters — a higher criterion wins outright and later ones are never evaluated. First, the router checks weight (Cisco-proprietary, local to the router — higher is preferred). Then local preference (higher preferred, shared within an AS to express outbound policy). Then the route with the shortest AS path — fewer autonomous systems traversed. Then origin type (IGP before EGP before incomplete). Then the lowest MED (Multi-Exit Discriminator), a hint from a neighbouring AS about which of its entry points to prefer. Then eBGP over iBGP. Finally, if still tied, the lowest IGP cost to the BGP next-hop, then the oldest eBGP route, then the lowest router ID. Network operators tune weight and local preference to shape outbound traffic, and MED to influence inbound traffic from a specific neighbour.
iBGP vs eBGP
eBGP (external BGP) runs between routers in different autonomous systems — the standard inter-AS protocol. iBGP (internal BGP) runs between routers within the same AS, synchronising BGP routes learned from outside so every router in the AS can reach them. iBGP does not modify the AS path (to avoid appearing as a new AS hop). A critical iBGP rule: routes learned via iBGP are not re-advertised to other iBGP peers. This means all iBGP speakers in an AS must be fully meshed — or the network must use route reflectors or confederations to scale.
BGP Route Reflectors
Full iBGP mesh requires n×(n-1)/2 sessions — with 100 routers that is 4,950 sessions. Route reflectors solve this. A route reflector (RR) is a designated router that re-advertises iBGP routes it receives to all its iBGP clients, eliminating the need for full mesh. Clients only need a session to the RR(s). The RR adds ORIGINATOR_ID and CLUSTER_LIST attributes to prevent loops. Most large networks deploy multiple RRs for redundancy, often as dedicated route-reflector-only routers carrying no customer traffic. This is one of the core scaling mechanisms that makes large ISP and data-centre networks tractable.
BGP Communities
BGP communities are 32-bit tags attached to route announcements and used to apply policy. A network might tag routes with community 65000:100 to signal "set local preference 100 at our peers" or 65000:666 to trigger blackholing. Communities are entirely operator-defined — there is no global registry except for a few well-known values (NO_EXPORT, NO_ADVERTISE, NO_EXPORT_SUBCONFED). Large transit providers publish community schemas that customers can use to control how their prefixes are advertised — requesting that a route not be exported to a specific region, or that it be prepended a number of times to make it look less preferred from certain directions.
How BGP Shows Up in Real Life
| Situation | What BGP Is Doing | User Symptom |
|---|---|---|
| Website outage | A prefix is withdrawn or misrouted | Site unreachable from some ISPs |
| High ping to a nearby service | Traffic takes a policy-driven detour | Latency feels oddly high |
| Cloud region failover | Routes shift to another location | Temporary jitter or path change |
| BGP hijack | Wrong network advertises someone else's prefix | Traffic may be blackholed or intercepted |
BGP Hijacking and RPKI
Because BGP is based on trust, any AS can announce any prefix. In 2008, Pakistan Telecom accidentally (or intentionally, depending on the account) announced YouTube's IP prefixes with a more-specific route. That announcement propagated globally within minutes, causing YouTube to become unreachable from most of the internet for roughly two hours before the announcement was withdrawn. This class of attack — BGP hijacking — has been used accidentally through misconfiguration and deliberately for traffic interception and spam.
RPKI (Resource Public Key Infrastructure) is the primary cryptographic defence. Network operators create ROAs (Route Origin Authorizations) — digitally signed records stating which ASN is authorised to originate which IP prefix with which maximum prefix length. Routers performing BGP Origin Validation check incoming announcements against the ROA database and can mark invalid announcements as RPKI-invalid, enabling them to be dropped. RPKI does not prevent path manipulation but does prevent unauthorised prefix origination. Adoption has grown substantially — major networks including Cloudflare, AT&T, and most large European ISPs now drop RPKI-invalid routes.
BGP Convergence and Internet Resilience
BGP convergence — the time for the internet to settle after a change — is deliberately slow. BGP uses timers that delay announcement propagation (MRAI — Minimum Route Advertisement Interval — is 30 seconds for eBGP by default). This prevents route flapping from causing instability across the internet. After a large event like a major peering link failure, full convergence can take several minutes as withdrawn routes propagate and alternative paths are selected. During convergence, some traffic may be temporarily undeliverable or take suboptimal paths. BGP's design prioritises stability over speed of reaction.
Frequently Asked Questions
What does BGP stand for?
BGP stands for Border Gateway Protocol. It exchanges route information between autonomous systems.
Why does BGP matter to normal users?
When BGP changes, traffic paths change. That can affect outages, latency, reachability, CDN selection, and sometimes speed test results.
Is BGP used at home?
No. Home routers use a default route toward the ISP. BGP operates between larger networks, not inside ordinary home LANs.