As you may already know, the Internet is a large collection of networks which are connected to each other by machines called routers. Naturally, one might ask, "How does data get from one network to another network?"

Enter routing.

Routers

Each router on the Internet is connected to a few networks, and passes data from network to network according to entries in its routing table. A routing table entry (route) contains all the information the router needs to know to figure out where to send an incoming packet. When a router receives a packet that isn't destined to the router itself, it has to decide how to forward it.

Routing Decisions

The router decides how to forward an incoming packet by finding the routes that "match" the destination address of the packet, and then forwarding it according to the most narrowly applicable one. A packet matches a route in the following way: a packet has (among other things) a destination address in its header, a route contains either a network or a host address, a network mask (netmask), and instructions on how to forward a packet using the route. The packet matches the route if its destination address is part of the address subspace defined by the network address or exactly matches the host address of the route. A route is more narrowly applicable than another if the address subspace defined by its network address contains fewer actual addresses than the other, which is indicated by the netmask. An entry with a host address, rather than a network address, is the narrowest kind.

Types Of Routes

Typically, there are four types of routes. The most common kind is the localhost route, which every computer on the Internet has (this is so the machine can send data to itself). The next most common kind is one that says "send everything to an address on one of my networks out my interface on that network." The next most common is a route that says "send anything that doesn't match any other routes to this other router." This kind of route is called a default route, for obvious reasons. The fourth kind of typical route is one that says "send everything destined to network X to router Y."

For routers that service a collection of dial-up users, there is also a fifth kind of route which is quite common. It is one that says "send everything destined to address X to the modem that computer is dialed in to." This is really just a very narrow case of the fourth kind of route.

Network Structure

With all this in mind, try to imagine the structure of the entire Internet (or any sufficiently large network, for that matter). In the "middle" of the Internet there are lots of very fast, long-distance networks that connect very large and sophisticated routers in distant places. These routers have to literally know where to send data in order to get it to any network on the Internet. Their routing tables normally have thousands and thousands of routes in them, all of which are the fourth kind of route. This part of the Internet is called the backbone, and the companies that run it are called Network Service Providers (NSPs). It's all part of the RoutingBusiness.

Connected to the NSPs are the Internet Service Providers (ISPs). In some cases, ISPs connect to the backbone through each other, or just connect to each other through each other. So some ISP routers have a few, or maybe even a few dozen type four routes. At any rate, the routers in an ISP network have a default route, and it points to the backbone. Since many smaller ISPs connect to bigger ISPs in order to connect to the Internet, there are sometimes several layers of them before you find the next level of structure in the Internet.

Host machines are connected to ISPs. "Host machine" is a general term that basically refers to any computer on the Internet that isn't a router. This includes both servers and clients. Host machines typically have only a handful of routes. One for packets destined to the network the host is on, one for the localhost, and one default route to the router on its network. Some servers are connected to more than one network simply because they send and receive so much data. In that case, there is a default route to a router on each network.

Dynamic Routing

The Internet's networks are constantly changing. This begs the question, who changes the routes? For the most part, the answer is no one. The vast majority of routing changes are made automatically. There are a variety of protocols that routers use to communicate with each other about routes. Each protocol has various advantages and disadvantages. The oldest routing protocol is the Routing Information Protocol (RIP). Some more recent protocols are Open Shortest Path First (OSPF), Border Gateway Protocol (BGP), and Exterior Gateway Protocol (EGP).

These protocols fall into two basic categories. There are internal routing protocols that are used for dynamic routing on a collection of networks that are under a single administrative control (like the networks owned by a single ISP or NSP). This routing "unit" is called an Autonomous System (AS). The RIP and OSPF protocols are internal routing protocols that are designed to manage the routing tables of routers within a single AS. The EGP and BGP protocols are used on the routers that connect ASs together, and are called border gateway protocols. They are used to manage the routes that direct data from AS to AS across the entire Internet.

Wireless Routing

Routing on a wireless network like SeattleWireless presents special challenges that are not normally found on conventional networks. Host machines, or possibly even routers and entire networks, may move either physically, or in terms of what routers they can contact directly, or both. This is referred to as roaming. By and large, there is much research to do in this particular field, and SeattleWireless is involved in, interested in, in charge of, or desperately seeking a few different ideas in this area. These ideas and projects are IntraIntra, MobileIp, MaNet, and WirelessInterRoutingProtocol. These ideas are more thoroughly explored in WirelessNetworkingSoftware and DevelopmentStatus.

The Answer

So, the question was, "How does data get from some computer to some other computer from faraway parts of the Internet?"

The answer is that when one of the computers (call it Guinness, assume it's in Ireland) sends data to the other (call it Sake, assume it's in Japan), Guinness sends the packets via its default route to the router on its network. That router probably also has a default route, as does the next, and so on until the packets reach a router on the backbone. Since the backbone routers know everything, this router (in, for example, Dublin) forwards the packet to another (in Manchester), which forwards it to another (in London), and so on until it reaches a backbone router in (for example) Osaka. The Osaka router knows that in order to reach Sake, the packet will have to leave the backbone and go to an ISP's router which it shares a network with. So the Osaka router forwards it to the ISP router, which matches the packet against something other than the default route and sends it to another ISP router, and so on until the packet reaches the router on Sake's network. Sake's router matches the packet against a route that forwards it to Sake, and the trip is complete.

Here's another good routing FAQ

RoutingForBeginners (last edited 2008-04-13 16:36:27 by localhost)