How Does Routing Work? (Part 2)

Yesterday, we discussed what routing is, but how do routers actually build their maps of the Internet?

The Internet has over 68,000 publicly visible networks, which means it’s impractical to know about the existence of every other network or how they’re connected. Networks can also appear and disappear, whilst connections are constantly coming and going due to various faults and reconfigurations. This makes it too complex to take manual decisions about how to route packets across the Internet.

Routers used by Internet Service Providers (ISPs) and other organisations with multiple connections to the Internet will invariably use dynamic routing. This is where a router automatically discovers how to reach another destination, and the optimal path to get there. 

Routers send regular advertisements (every 10-60 seconds) about what parts of the Internet they’re able to reach, known as routes. Each router builds a routing table that lists all possible routes to all possible destinations. Based on that routing table, a router selects what it thinks is the best path to the packet’s destination – usually it is the shortest path, unless a policy is in place to pick a different one.

To continue our online dating analogy, think of dynamic routing as working with a matchmaker. You don’t know all the single people in the world, but your matchmaker knows all the single people within a few towns, and knows all the other matchmakers nearby who know others farther away, and so on.

There are different routing protocols for different purposes, but for our interests, we will focus on Border Gateway Protocol, or BGP. BGP4 is the de-facto protocol used to discover external networks and their routing policies, and it allows routers to generate their own routing tables – the roadmaps of the Internet.

BGP uses Autonomous System Numbers, or ASNs, to identify networks in the same administrative domain, such as an ISP or large enterprise. Routers also use ASNs to determine whether routes should be accepted or rejected from another router, or to give preference to certain paths over others.

Just like a matchmaker screens your potential dates for compatibility based on your interests, preferences, and deal-breakers, routers will screen for the best path based on the network’s policies. Some networks have customer relationships with other networks, some will have agreements with other networks to transit traffic at no cost, whilst certain paths through the Internet may be preferable for other various reasons.

It’s a bit like how the satellite navigation system in your car works, where you can choose whether you want to take the fastest route or the one avoiding tolls, and which can offer you alternative routes if you hit slow traffic or road closures. 

Each router will have a different view of the Internet, although the largest ISPs in the Internet ‘core’ (more correctly referred to as the Default-Free Zone) will typically see most/all of the possible routes. Currently more than 900,000 routes are being publicly advertised with BGP. 

In two posts, we’ve covered the basics of what routing is and how it works, so why are we getting concerned about something that’s worked pretty well for the last 25+ years? We’ll be considering this in the next post of this blog series, so check back tomorrow!

Leave a Comment