- Introduced by
- IETF Routing Protocols Working Group
- Year
- 1989
- Type
- path-vector routing protocol
- Family
- Routing protocol
What does it do?
BGP is the de facto standard routing protocol for exchanging reachability information between autonomous systems (ASs) on the Internet.
Introduced in 1989, it now carries full Internet routing tables, which contain a very large number of prefixes. It is a path-vector protocol that uses a configurable policy system to control which routes are accepted, advertised and preferred.
The intuition behind the method
The Internet is a network of networks (autonomous systems), each operated by a different organisation. Each AS runs an interior gateway protocol (IGP such as OSPF or IS-IS) to manage its own internal topology. BGP connects ASs: each router advertises the prefixes (IP address blocks) its AS can reach and learns prefixes from its neighbours. Operators use policies to filter, modify and rank routes, often according to business relationships with customers, peers and providers. Because each route carries the sequence of ASs it has crossed, a router can reject any route that already contains its own AS, which prevents loops. Each router selects one best path per destination from the routes it has received.
History
BGP was introduced in 1989 to replace the earlier Exterior Gateway Protocol (EGP) for routing between autonomous systems. Its core design has remained largely stable through the growth of the Internet. The BGP-4 specification is RFC 4271, cited in the references as Rekhter, Li and Hares (2006). Later work has focused on security, including RPKI, ROV and ASPA, to address hijacking and route leaks. EVPN extends BGP to data-centre and provider Ethernet services.
When to use it
Use BGP to exchange routes between autonomous systems, for example when an organisation connects to one or more upstream ISPs (multi-homing) or when an ISP peers with other networks. Within a single AS, an IGP such as OSPF or IS-IS is normally preferred because it converges faster and needs less policy configuration. BGP policy design is powerful but error-prone, so it requires operators with specific experience in inter-domain routing. Do not use it where a static route or an IGP already meets the requirement.
Limitations and considerations
- Convergence latency: after topology or policy changes, routers may take a long time to settle on new best paths
- Policy complexity: misconfigured import or export policies can filter legitimate routes or select suboptimal paths
- Weak origin validation: BGP itself does not verify that an AS is entitled to originate a prefix, so bogus announcements can attract traffic; RPKI-based origin validation (ROV) and path-validation work such as ASPA reduce this risk but are not universally deployed
- Route hijacking and leaks: a prefix announced by the wrong AS, or a route propagated beyond its intended scope, can redirect or disrupt traffic
- State growth: very large routing tables consume memory and CPU on border routers
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Internet-scale: it carries full Internet routing tables across a very large number of routers
- Policy control: operators can filter and rank routes per neighbour, which lets routing follow commercial relationships
- Loop prevention: the AS-path attribute lets a router reject any route that already contains its own AS
- Selective propagation: only the best path for each prefix is advertised onward, so routers do not need to propagate every path they know
- Loop-free path construction: standard path-vector operation does not create routing loops, although policy configurations can still prevent convergence in some cases
Applications
- Internet backbone routing: ISP backbone routers run BGP for inter-AS routing
- Multi-homing: enterprise customers connect to multiple ISPs via BGP
- Content delivery: CDNs use BGP to control traffic steering to optimal edge nodes
- Traffic engineering: selective AS-path prepending and local preference control traffic
- EVPN: BGP-based Ethernet VPN for data center and provider services
How it works
How it works
Routers in each AS act as BGP speakers and establish sessions with their neighbours: eBGP sessions connect routers in different ASs, and iBGP sessions connect routers within the same AS.
Prefixes that the AS originates or learns from its IGP are advertised to neighbours with attributes such as the AS-path and MED. Local preference is used inside an AS and is not sent to external neighbours.
For each prefix, a router compares the candidate routes it has received using an ordered set of decision rules. Where the implementation supports it, a vendor-specific weight is considered first; it is local to the router and is not advertised. The router then prefers the route with the highest local preference, then a locally originated route, then the shortest AS-path, then the lowest origin type, then the lowest MED (by default compared only between routes from the same neighbouring AS). Next it prefers an eBGP-learned route over an iBGP-learned one, and then the route with the lowest IGP metric to its next hop. Remaining ties are broken by the lowest router ID and then by the lowest peer address. This list summarises the decision procedure in RFC 4271; implementations add extensions, so the vendor documentation governs specific behaviour.
The selected best path is installed in the routing table. Export policies then decide which best paths are advertised to each neighbour, so the resulting routing state depends on both the decision process and the configured policies.
Packets are forwarded along the installed best paths. To check a route, examine the BGP table on the router for the prefix and confirm which path is marked as best and which next hop it uses. Checking the same prefix on several routers shows whether the chosen paths are consistent across the network. Confirm that each BGP session is in the Established state, because routes are exchanged only over established sessions. Keepalive messages keep a session alive. If no keepalive or update arrives before the hold timer expires, the router declares the session down and withdraws the routes learned from that peer. This is how failures are detected, so the timer values determine how quickly a failure is noticed. After a topology or policy change, routers exchange updates and reselect paths. To measure convergence, record the time from the change until the relevant routers all show the expected best path, and compare that with the expected behaviour of the network. Convergence time depends on update propagation, timer settings and policy, and it can be slow.
Common pitfalls
- Misconfigured export policies: advertising routes learned from one provider to another provider can misdirect or disrupt traffic on a large scale
- Leaving convergence timers at defaults: default timers may be too slow for latency-sensitive paths, so they should be reviewed for the application
- Assuming BGP provides security: without RPKI validation, a router has no built-in means to confirm that an announced prefix belongs to the announcing AS
- Treating AS-path length as proof of validity: an AS-path can be forged, so a short path is not necessarily a genuine one
- Not monitoring BGP sessions: session or convergence problems can go unnoticed until traffic is affected
Frequently asked questions
What is the difference between iBGP and eBGP?
eBGP connects routers in different ASs, and each AS adds its own number to the AS-path when it advertises a route. iBGP connects routers within the same AS and does not change the AS-path. Because iBGP speakers do not re-advertise iBGP-learned routes to other iBGP speakers, iBGP needs a full mesh or route reflectors to scale.
How does BGP prevent routing loops?
The AS-path lists every AS a route has traversed. A router rejects any route whose AS-path contains its own AS number, which prevents AS-level loops.
What is route filtering and when is it used?
Route filters (import and export policies) let operators accept only certain routes from a neighbour or advertise only certain routes to it. They are widely used for traffic engineering and to limit the impact of route leaks and hijacks.
What is RPKI and why is it important?
RPKI (Resource Public Key Infrastructure) cryptographically binds IP prefixes to the ASNs authorised to originate them. Routers performing route origin validation (ROV) classify announcements against these records and can reject invalid ones, which reduces prefix hijacking. Deployment is not yet universal.
Related methods
Sources
Rekhter, Y., Li, T., & Hares, S. (2006). A Border Gateway Protocol 4 (BGP-4). RFC 4271.
Open publication referenceStewart, J. W. (2014). BGP Design and Implementation (2nd ed.). Cisco Press.
Open publication reference