# BGP

> The protocol networks use to tell each other which addresses they can reach.

- Level: Advanced
- Topics: Networks
- URL: https://tidbit.legios.com.ar/bgp/
- In Spanish: [BGP](https://tidbit.legios.com.ar/es/bgp/)

The internet is not one network but tens of thousands of independent ones: internet providers, universities, cloud companies, big websites. Each is an **autonomous system** (AS) with its own number. **BGP**, the Border Gateway Protocol, is how they tell each other which IP addresses they can deliver to. It is the reason a packet that leaves your home in Buenos Aires knows how to reach a server in Frankfurt.

The mechanism is a chain of announcements. A network says to its neighbors 'I am the home of these addresses'. Each neighbor passes the news on, adding itself to the path: 'you can reach them through me'. Every router at the edge ends up with several possible routes to each destination and picks one according to its own rules, often preferring shorter paths or cheaper business agreements. BGP is not about finding the fastest path; it is about policy, about who agrees to carry whose traffic.

BGP was designed when the networks on the internet largely trusted each other, and by default a router believes what its neighbors announce. That makes mistakes contagious. If a network wrongly announces addresses that are not its own, by accident or on purpose (a **BGP hijack**), traffic can be pulled toward it. In 2008 a provider in Pakistan meant to block YouTube locally and briefly took it offline for much of the world; in 2021 Facebook withdrew its own routes during maintenance and disappeared from the internet for hours.

The fixes are gradual. **RPKI** lets an address owner publish a signed statement of which networks may announce its addresses, so others can reject impostors, and providers increasingly filter what their customers are allowed to announce. For most people BGP is invisible, until it breaks and a huge site is suddenly unreachable.

## An analogy

A chain of travel agents passing along notes: 'I can get you to Lisbon'. Each one adds its own name and forwards the note. It works because they believe each other, and that is also why one agent writing a wrong note can send everyone's trips the wrong way.

## Keep in mind

- Connects the tens of thousands of independent networks that make up the internet.
- Networks announce the addresses they reach; neighbors pass the routes along.
- Route choice follows business policy, not just distance or speed.
- Built on trust, so bad announcements spread; RPKI and filtering reduce the risk.

## Go deeper

- [Border Gateway Protocol on Wikipedia](https://en.wikipedia.org/wiki/Border_Gateway_Protocol)
- [RFC 4271, the BGP-4 specification](https://www.rfc-editor.org/rfc/rfc4271)

## Related terms

- [Internet](https://tidbit.legios.com.ar/internet/): A worldwide network of networks that lets any connected device reach any other.
- [ISP](https://tidbit.legios.com.ar/isp/): The company you pay to connect your home or phone to the internet.
- [Cloud computing](https://tidbit.legios.com.ar/cloud-computing/): Renting computers over the internet instead of buying your own.
- [IP address](https://tidbit.legios.com.ar/ip-address/): The number that identifies a device on a network, like a postal address.
- [Packet](https://tidbit.legios.com.ar/packet/): The small chunk every piece of internet data is cut into before it travels.
- [Server](https://tidbit.legios.com.ar/server/): A computer whose job is to answer requests from other computers, all day, every day.
- [Router](https://tidbit.legios.com.ar/router/): The box that connects your devices to each other and to the internet.
- [Meta](https://tidbit.legios.com.ar/meta/): The company behind Facebook, Instagram and WhatsApp, paid for by advertising.
