The internet is not one network but tens of thousands of autonomous systems, each with its own rules. BGP is the protocol they use to exchange routes and choose the path traffic takes between networks. Inside a single network, OSPF or static routes do the work, but as soon as a packet has to go to another operator, BGP takes over.
How BGP differs from interior protocols
Inside an autonomous system, interior protocols such as OSPF, IS-IS and RIP look for the shortest path by their own metric. BGP solves a different problem: it connects networks with different owners, where each decides whom to let go where. That is why it is called a policy protocol: routes are chosen by the operator’s rules, not by a metric. The protocol was described in 1989 (RFC 1105), version 4 appeared in 1995 (RFC 1771), and the current edition is RFC 4271 from 2006.
| Property | Interior protocols (OSPF, IS-IS) | BGP |
|---|---|---|
| Where it runs | inside one autonomous system | between autonomous systems |
| Path selection | a metric: the total “cost” of links | operator policy and route attributes: LOCAL_PREF, AS_PATH, MED |
| Where paths come from | the protocol builds the network topology itself | neighbours advertise complete ready-made routes |
| Updates | topology is recalculated after every change | incremental UPDATE messages; no periodic refresh |
How a session works
Two routers open a TCP connection to port 179 and become neighbours; this is called peering. Neighbours in another AS are external (eBGP), those in the same AS are internal (iBGP). Inside an AS, all BGP routers keep iBGP sessions with each other so that every one of them sees the external routes. Each advertisement carries AS_PATH, the list of autonomous systems along the way: if your own number is in it, there is a loop and the route is discarded.
router bgp 64512 neighbor 203.0.113.1 remote-as 64510 network 198.51.100.0 mask 255.255.255.0- OPEN: the introduction, with the protocol version, your AS number and timers;
- UPDATE: advertises new prefixes and withdraws vanished ones, with path attributes;
- KEEPALIVE: a periodic confirmation that the connection is alive;
- NOTIFICATION: an error message, after which the session is closed.
How many routes the internet has
The internet’s BGP table has grown to about 1.1 million IPv4 routes from almost 80,000 autonomous systems. A full table needs a lot of memory, so anything unnecessary is filtered out at the network edge. MP-BGP extensions let BGP carry more than IPv4 routes: this is how IPv6 prefixes, MPLS VPN routes and EVPN in data centres are distributed. In leaf-spine topologies and container clusters, BGP is also run on ordinary servers.
Sources
the term is written from these pagesVerified 9 Nov