What is BGP
BGP (Border Gateway Protocol) is a distance vector routing protocol that establishes route reachability between autonomous systems and selects the best path among the routes it learns. As networks grew, they were divided into separate autonomous systems (AS) to keep them manageable, and an early protocol — EGP (Exterior Gateway Protocol) — was introduced in 1982 to exchange routing information between them. EGP only published which networks were reachable; it had no way to prefer one path over another or guard against routing loops, and it couldn't keep up as networks scaled. BGP replaced it, adding path selection, loop prevention, and the ability to carry large volumes of routing information efficiently between AS.
BGP isn't always the right tool for every link, though. On a data center's uplink to the internet, for example, exposing the internal network to the full scale of internet routing tables via BGP is often unnecessary risk — a static route to the external network is frequently the simpler, more contained choice.
BGP comes in two operating modes: IBGP (Internal BGP), which runs between devices inside the same AS, and EBGP (External BGP), which runs between devices in different AS. Because IBGP peers don't re-advertise routes learned from other IBGP peers — the mechanism that would otherwise create loops inside the AS — a fully-connected mesh of IBGP sessions is normally required, which is where route reflectors come in to simplify that topology. EBGP, by contrast, prevents loops simply by discarding any route that already carries the local AS number, and needs no route reflector. Since most devices in a network are assigned different AS numbers, EBGP is the more common mode in practice; IBGP typically shows up between a pair of redundant devices sharing the same AS number.
How BGP Works
Two devices exchanging BGP information are called peers, and the switch actively sending BGP packets is a BGP Speaker — it both generates new routing information and advertises it onward to other Speakers. Related peers can be grouped into a Peer Group for shared configuration.
Every BGP device is identified by a Router ID, a 32-bit value usually expressed as an IPv4 address and carried in the Open packet exchanged when a session is established. Two peers can't form a BGP session unless each has a unique Router ID.
At a high level, establishing and running a BGP relationship follows this general flow:
· AS and Router ID setup: Each device is configured with its AS number and (usually) a unique Router ID, often drawn from a Loopback interface address for stability regardless of physical link status.
· Neighbor/peer establishment: A device is told the IP address and AS number of each neighbor it should peer with — matching AS numbers on both sides identifies the session as IBGP, differing numbers as EBGP.
· Route exchange and best-path selection: Once a session is up, peers exchange reachable prefixes; each device evaluates the routes it receives against its policies and its BGP path-selection rules to choose the best path to each destination.
· Loop prevention: IBGP relies on the "don't re-advertise to other IBGP peers" rule; EBGP relies on discarding any route already tagged with the local AS number in its AS-path.
· Route reflection (IBGP): Instead of meshing every IBGP device together, a Route Reflector (RR) can be designated so that other devices peer only with the RR, which then reflects routes among its clients — cutting down the number of sessions each device must maintain.
Why BGP is Beneficial
The core value of BGP lies in scalable, policy-aware route exchange across administrative boundaries:
· Loop-free route exchange between AS: Built-in AS-path and IBGP re-advertisement rules keep routing loops from forming as routes cross network boundaries.
· Best-path selection, not just reachability: Unlike its EGP predecessor, BGP actively compares candidate routes and selects the best one, rather than simply reporting what's reachable.
· Scales to large routing tables: BGP is built to carry and maintain large volumes of routing information reliably, which is why it underpins inter-AS routing across the internet as well as large data center fabrics.
· Flexible, policy-driven control: Route maps, redistribution of other protocols' routes, and per-session tuning give administrators fine-grained control over what gets announced, accepted, and preferred.
· Fast convergence when paired with BFD: Linking BGP with BFD (Bidirectional Forwarding Detection) lets link failures trigger near-immediate session teardown and route recalculation, instead of waiting on BGP's own slower failure-detection timers.