What is BGP?
BGP is the protocol independent networks use to tell each other which addresses they can reach. It is the reason a packet from Lisbon finds its way to a server in Warsaw.
What job does BGP do?
It exchanges reachability information between autonomous systems, the tens of thousands of separately run networks that make up the internet. Each one announces the address blocks it can deliver to, and its neighbours pass those announcements onward with their own network number added. From the collection of announcements it hears, every border router builds a table of the best path to every prefix on the internet, currently around a million IPv4 routes and a quarter of a million IPv6 routes.
What is an autonomous system?
A network under one routing policy, identified by an autonomous system number (ASN). Access providers, hosting companies, universities and large content networks each have one or several. An ASN is a 32-bit number today, written plainly such as AS64500 (a documentation value). Regional internet registries assign them, together with the address blocks the network will announce. You can look up which network announces any address with a public whois service:
whois -h whois.radb.net 9.9.9.9 | grep -E '^(route|origin):' dig +short TXT 9.9.9.9.origin.asn.cymru.com
How does a router choose between paths?
By policy first, then by a fixed tie-break list. Operators set local preference to favour, for example, a free peering link over paid transit. When preferences are equal, the shortest AS path wins, then the origin type, then the multi-exit discriminator, then other tie-breakers down to the lowest router ID. BGP does not measure latency or load; a path through three networks can be slower than one through five. That is why well connected networks tune their policies and peer widely.
| Step | Attribute | Preference |
|---|---|---|
| 1 | Local preference | Higher wins, set by the operator |
| 2 | AS path length | Shorter wins |
| 3 | Origin | IGP over EGP over incomplete |
| 4 | MED | Lower wins, between the same neighbour |
| 5 | eBGP over iBGP, IGP cost, router ID | Final tie-breaks |
What are route leaks and hijacks?
Mistakes or attacks where a network announces addresses it should not. A hijack announces someone else's prefix, often a more specific one, which pulls their traffic towards the wrong network. A leak passes routes learned from one provider to another in violation of policy, sending traffic on a long detour. Both happen several times a year at a scale that makes the news. The defences are filtering at every border and cryptographic origin validation.
What is RPKI?
The Resource Public Key Infrastructure lets address holders publish signed statements, called ROAs, saying which ASN may originate their prefixes and how specific the announcement may be. Routers that perform route origin validation drop announcements marked invalid, which stops the most common hijacks and many accidental leaks. Adoption has grown quickly; most large transit networks now reject invalid routes. You can check the status of any prefix against public validators from a shell with rpki-client or the routinator tool.
Does a dedicated server need to speak BGP?
No. A rented server sits on an address block the data centre network announces for you, and your machine simply uses its default gateway. Running BGP yourself requires your own ASN and address space plus a provider that accepts a BGP session from the server, which we do not offer. If you need traffic to fail over between data centres, use DNS with a short time to live or an application-level design instead. Picking a well connected location matters far more than any routing knob on the machine itself.
How does routing affect the performance I see?
It decides the path, so it decides much of the latency. Two users in the same city on different access providers can see different round trip times to the same server because their networks hand traffic over at different exchange points. When you compare data centres such as Frankfurt and Strasbourg, test from networks your users actually use. A traceroute shows the autonomous systems along the way when asked:
mtr -z -rwc 50 example.net traceroute -A -q 1 2001:db8:300::9
Why do outages sometimes spread across the internet?
Because BGP trusts announcements by default and propagates them fast. A single bad announcement can reach routers worldwide within a minute. When a large network withdraws its own routes by mistake, its services vanish for everyone at once, even though every server is running. Filtering, RPKI and careful change management at network operators reduce these incidents, and keeping your own services in more than one location, for example London plus Beauharnois, limits the effect of any single routing event on your users.
Related pages
BGP in a hosting network
How a hosting network uses BGP day to day: multihoming, choosing exits, communities, anycast and filtering, and what that means for traffic to your server.
Read moreNetwork connectivity
What connects a server to its users: ports, uplinks, transit, peering, latency and packet loss, and how to measure each one yourself.
Read morePoint of presence
Where networks meet: what a point of presence contains, how exchanges and peering use them, and how they differ from a data centre hosting servers.
Read moreNetwork backbone
The long-distance core that links data centres and exchange points: how backbones are built, why capacity and path diversity matter, and testing routes.
Read moreQuestions and answers
What does BGP stand for?
Border Gateway Protocol. It exchanges routes between autonomous systems, the independently operated networks that make up the internet.
Can I run BGP on a rented dedicated server here?
No. Servers use the address block the data centre network announces, and BGP sessions with customer servers are not offered. Use DNS or application failover instead.
What is an ASN?
An autonomous system number identifies a network with one routing policy. Registries assign them to providers, hosting companies and large organisations.
What is a BGP hijack?
An announcement of address space by a network that does not hold it, pulling traffic for those addresses to the wrong place. RPKI origin validation blocks most of them.
Does BGP choose the fastest path?
Not directly. It chooses by operator policy and then the shortest list of networks, which usually but not always matches the lowest latency.