BGP for Beginners: How the Internet Picks Routes

BGP is the internet's routing protocol that determines how data travels between networks worldwide. This beginner-friendly explanation covers Autonomous Systems, peering relationships, and why BGP misconfigurations can cause massive internet outages.

BGP for Beginners: How the Internet Picks Routes

Ever wondered how your email reaches someone on the other side of the world, or how Netflix streams arrive at your device? The answer lies in the Border Gateway Protocol (BGP) — the routing protocol that makes the global internet work.

Think of BGP as the internet's GPS system, but instead of finding routes between cities, it finds the best paths between different networks across the globe.

What is an Autonomous System?

Before we dive into BGP, you need to understand Autonomous Systems (AS). An AS is essentially a collection of networks under single administrative control. Your internet service provider (ISP) has an AS, Google has multiple AS numbers, and even large universities often have their own.

Each AS gets assigned a unique number called an ASN (Autonomous System Number). For example:

  • Google: AS15169
  • Cloudflare: AS13335
  • Amazon: AS16509

These numbers help BGP routers identify different networks and make routing decisions.

How BGP Works: A Simple Story

Let's say you're sending a message from your home in New York to a friend in Tokyo. Here's how BGP makes it happen:

Step 1: Your Local Network
Your message starts at your home router, which connects to your ISP (let's call it "NYC-ISP" with AS65001).

Step 2: Route Advertisement
NYC-ISP knows about your friend's network in Tokyo through BGP route advertisements. Tokyo's ISP (AS65002) has previously announced: "Hey everyone, I can reach the 203.0.113.0/24 network where your friend lives."

Step 3: Path Selection
BGP doesn't just find one route — it learns about multiple possible paths. Your message might travel:

  • NYC-ISP → European Provider → Tokyo-ISP
  • NYC-ISP → West Coast Provider → Pacific Cable → Tokyo-ISP
  • NYC-ISP → Satellite Provider → Tokyo-ISP

BGP automatically selects the "best" path based on various factors like path length, business relationships, and network policies.

Peering: How Networks Connect

Networks don't connect randomly — they form business relationships called peering agreements. There are two main types:

Transit: Smaller networks pay larger ones for internet access. Your home ISP pays a larger "Tier 1" provider like AT&T or Verizon to reach the rest of the internet.

Peering: Networks of similar size exchange traffic for free. Netflix might peer directly with your ISP so your streaming traffic doesn't travel through expensive transit links.

These relationships directly influence BGP routing decisions. A network will prefer routes through peers over expensive transit providers.

When BGP Goes Wrong

BGP's flexibility is also its weakness. Since networks trust each other's route announcements, mistakes can cause massive outages.

In 2021, Facebook accidentally withdrew all their BGP route announcements, essentially telling the internet "we don't exist anymore." Result? Facebook, Instagram, and WhatsApp disappeared from the internet for six hours.

Another common problem is "route hijacking" — when a network accidentally (or maliciously) announces routes they don't actually control. Imagine if a small ISP in Europe suddenly announced they could reach Google's servers. Traffic might get misdirected through their network, causing slowdowns or security issues.

BGP in Action

You can actually see BGP in action on your own network. Try this command on a Cisco router:

Router# show ip bgp summary
BGP router identifier 10.1.1.1, local AS number 65001
BGP table version is 45, main routing table version 45
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
203.0.113.1     4        65002      98      95       45    0    0 01:25:15       350

This shows your router has learned 350 routes from neighbor AS65002. Each of these routes represents networks that AS65002 can reach.

Why BGP Matters to You

Understanding BGP helps explain why:

  • Internet outages can affect millions of users simultaneously
  • Some websites load faster than others
  • Network engineers get paid well to manage these complex systems
  • The internet is remarkably resilient despite its complexity

BGP runs automatically in the background, making thousands of routing decisions per second to ensure your cat videos reach you as quickly as possible.

What's Next

Now that you understand BGP basics, you're ready to explore more advanced routing concepts. Next, we'll dive into OSPF — the protocol that handles routing within individual networks, and how it works alongside BGP to create the complete internet routing picture.