Part 5 · How the Internet is wired and run

BGP, autonomous systems and IXPs: how the Internet is wired

lesson 12 / 1912 min1 labpublished updated
Course contents
On this page
  1. Autonomous systems (AS)
  2. Interior routing protocols
  3. BGP: the protocol that holds the Internet together
  4. Business relationships: transit, peering and tiers
  5. IXPs: where networks meet
  6. CDNs and anycast
  7. The physical Internet
  8. Routing security: why BGP is fragile

In lesson 1, step 6 of opening a web page was “router after router across the Internet”, and in the routing lesson you built a router whose routes you typed in by hand. Nobody types in the routes for the whole Internet. This lesson shows how routers learn them, and why the answer is as much about business as about technology.

The Internet is not one network. It is more than 70,000 independent networks, each with its own owner, policies and routers, that use a protocol called BGP to tell each other “these addresses are reachable through me.” There is no central point of control. This lesson follows that idea from routing inside a single network to BGP between networks, the business deals behind every route, and the cables underneath it all.

Autonomous systems (AS)

An AS is a set of networks under one administration with a single routing policy: an ISP, a cloud provider, a university or a large company. Every AS has a number, its ASN (32 bits; for example, AS13335 is Cloudflare and AS15169 is Google). ASNs and IP blocks are allocated by the RIRs, covered in the next lesson.

There are two levels of routing:

  • Inside an AS (an IGP, interior gateway protocol): find the shortest path between your own routers.
  • Between ASes (an EGP): this is BGP, and paths are chosen by policy and business contracts, not by shortest distance.

Interior routing protocols

  • Distance vector (for example RIP): each router only tells its neighbors what is in its own table (“I can reach X at distance n”). Simple, but slow and prone to loops; today you will find it almost only in textbooks.
  • Link state (for example OSPF and IS-IS): each router floods the state of its links to every other router, so they all hold a complete map of the network and compute shortest paths with Dijkstra’s algorithm. When a link fails, every router quickly agrees on the new paths (fast convergence). To scale, OSPF splits the network into areas (area 0 is the backbone). IS-IS is common in large ISP networks.
  • Large data centers often run BGP even inside their own network (RFC 7938).

BGP: the protocol that holds the Internet together

BGP-4 (RFC 4271) runs over TCP port 179 between routers in two ASes (a “session,” or “peering”). Each AS announces which prefixes can be reached through it.

AS 100Tier 1AS 200Tier 1peeringAS 300regional ISPAS 500another ISPtransittransitIXP (shared switch fabric)AS 300, AS 400 and AS 500 peer hereAS 400CDN / contentAS 64500you: 203.0.113.0/24transithow the route to 203.0.113.0/24 spreads:AS 64500 -> AS 300 AS_PATH: 64500AS 300 -> AS 100 AS_PATH: 300 64500AS 100 -> AS 200 AS_PATH: 100 300 64500solid arrow = customer to provider · dashed = peering
ASes connected by transit and peering, an IXP, and the path of one prefix as it spreads with its AS_PATH.
  • eBGP runs between two different ASes. iBGP runs inside one AS, to distribute external routes among its own routers.
  • Every announcement (an UPDATE) carries a prefix and path attributes:
    • AS_PATH: the list of ASes the announcement has passed through. It prevents loops (an AS that sees its own number in the path rejects the route) and lets routers prefer shorter paths.
    • NEXT_HOP: which router to send the traffic to.
    • LOCAL_PREF: the AS’s internal preference (higher wins); the main policy tool.
    • MED: a hint to a neighbor about which entry point to use.
    • Community: tags that carry policy, such as “don’t announce this to peers” or “blackhole this.”
  • Best-path selection (simplified): highest LOCAL_PREF, shortest AS_PATH, lowest origin, lowest MED, eBGP over iBGP, closest NEXT_HOP.
  • BGP announces routes as prefix + path, and routers decide with longest prefix match. That is why announcing a more specific prefix (a /24 against a /22, say) “steals” the traffic.
  • Today’s full Internet routing table holds more than one million IPv4 prefixes and about 200,000 IPv6 prefixes. The smallest prefix generally accepted is a /24 for IPv4 and a /48 for IPv6.

Business relationships: transit, peering and tiers

  • Transit: one AS pays another for access to the whole Internet (a customer and a provider).
  • Peering: two ASes exchange traffic between their own customers directly, usually without payment (settlement-free), because it pays off for both of them.
  • Tier 1: networks that pay no one for transit and peer with every other Tier 1. Examples are Lumen, NTT, Arelion (formerly Telia Carrier), GTT and Tata. Tier 2 networks both buy transit and peer. Tier 3 networks only buy transit.
  • The golden rule of routing policy (Gao-Rexford): announce customer routes to everyone; announce peer and provider routes only to customers. Breaking this rule is a route leak.

IXPs: where networks meet

An Internet Exchange Point is a large switch fabric (usually layer 2) in a data center. Hundreds of ASes connect to it and peer with each other: one connection instead of hundreds of separate cables. The largest include DE-CIX (Frankfurt), AMS-IX (Amsterdam), LINX (London) and IX.br (Brazil).

A route server at an IXP lets you peer with everyone through a single session. PeeringDB is the public database of which network is present at which IXP and data center.

CDNs and anycast

  • A CDN (content delivery network) such as Cloudflare, Akamai, Fastly or CloudFront runs thousands of servers close to users that cache content, terminate TLS and protect the origin. A large share of today’s Internet traffic comes from CDNs and big content networks (Google, Netflix, Meta) that sit directly inside ISPs and IXPs.
  • Anycast: a single prefix is announced via BGP from dozens or hundreds of places around the world, and BGP takes each user to the “nearest” one (in routing terms). 1.1.1.1, 8.8.8.8, the DNS root servers and most CDNs use anycast. It works very well for UDP and short TCP connections, and it spreads DDoS attacks across all those locations.
  • Another way to steer users is GeoDNS: DNS returns a different address depending on where the resolver is.

The physical Internet

  • Submarine cables: close to 700 cable systems (per TeleGeography’s 2026 map) carry more than 99% of intercontinental traffic; satellites carry only a small share. Big content companies (Google, Meta, Microsoft, Amazon) now own or co-own a large part of the new cables. Cable cuts (by ship anchors, for example) happen every year and hit countries with few routes hard.
  • Data centers and carrier hotels: buildings where hundreds of networks have a physical presence and connect to each other with cross-connects.
  • The last mile (the link to the user): DSL over phone lines, cable (DOCSIS), fiber to the home (FTTH, usually GPON or XGS-PON), mobile (4G LTE and 5G, both 3GPP standards), fixed wireless, and LEO satellites such as Starlink, with latency of about 20 to 50 ms (against 600 ms for older GEO satellites).

Routing security: why BGP is fragile

BGP was originally built on trust: any AS can announce any prefix.

  • BGP hijack: an AS announces a prefix that isn’t its own, on purpose or by mistake. The most famous case: in 2008 a Pakistani ISP, trying to block YouTube inside the country, announced a more specific /24 from YouTube’s address space. The announcement leaked to the whole world, and YouTube was unreachable everywhere for about two hours.
  • Route leak: an AS announces routes learned from one provider or peer to another provider, and unintentionally pulls huge amounts of traffic through itself.
  • The 2021 Facebook outage: a faulty command during maintenance cut Facebook’s internal backbone. Its DNS servers, which could no longer reach the data centers, withdrew their prefixes from BGP, exactly as designed, and Facebook, Instagram and WhatsApp vanished from the Internet for about six hours. Even the badge readers on their buildings stopped working.

The defenses:

  • RPKI (Resource Public Key Infrastructure, RFC 6480): the holder of a prefix publishes a signed ROA (through its RIR) that says which AS may announce the prefix and the maximum prefix length. Routers running route origin validation reject invalid announcements. A large part of the Internet does this today.
  • IRR (Internet Routing Registry) data and filtering of customer prefixes.
  • ASPA and BGPsec: validate the whole path, not just the origin; both are still being rolled out.
  • MANRS: a set of baseline routing-security practices (filtering, anti-spoofing, coordination, validation) that networks commit to.