Bookmarks

BGP — Border Gateway Protocol

A network protocol that autonomous systems (internet providers, data centres, large companies) use to exchange routes and agree how to deliver traffic between their networks.

Also: bgp-4, border gateway protocol, exterior gateway protocol

checked 9 Nov

All terms

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.

PropertyInterior protocols (OSPF, IS-IS)BGP
Where it runsinside one autonomous systembetween autonomous systems
Path selectiona metric: the total “cost” of linksoperator policy and route attributes: LOCAL_PREF, AS_PATH, MED
Where paths come fromthe protocol builds the network topology itselfneighbours advertise complete ready-made routes
Updatestopology is recalculated after every changeincremental 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.

iosAdvertising your own network and the provider’s neighbour (Cisco IOS)
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 pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • OSPFOpen Shortest Path First

    OSPF computes routes inside one autonomous system by link metric; BGP exchanges routes between autonomous systems, and operator policy decides the choice.

In depth in the references

where the topic is covered in detail