seegongsik
Networks

How does routing work

We saw that a letter is passed along through intermediate post offices. But at every fork, how does a post office decide where to send it next? There is no one at the center giving orders; each stop chooses the way on its own. That is routing.

01

Choosing at the Fork

A packet travels through intermediate stops. But arriving at a stop, it is rare for there to be only one way out; usually there are several neighboring stops.
So which stop should it be passed to next? Making that choice is where routing begins. On the internet, these stops are called routers.

SABCD
here now: Sdestination: D
Tap a blinking neighbor to hand the packet on

Tap one of the blinking neighbor stops to pass the packet on. (stop = router · tap = choose the next stop) Choose at every fork and you reach the destination.

One pass and the packet moved to a neighboring stop, where another fork appeared. Passing it on one stop at a time like this, it eventually reaches the destination.
But picking any neighbor at random could send it circling somewhere it does not need to go. So every stop needs a rule for choosing.

02

Looking at the Route Table

Every stop keeps a small table. Let us call it a route table. Each row says, "To reach this destination, pass it to this neighbor."
When a packet arrives, the stop looks at the destination address, finds that row in the table, and passes the packet to the stop written there. In real routers this is called a routing table.

Stop R's route table
DestinationNext
Tap a destination row to look up the next stop

Tap a destination row in the route table and it shows which stop to pass the packet to next to reach that destination. (table = route table) Different destinations can point to the same neighbor.

With a table, a stop never wanders. Wherever the destination is, finding that one row settles the next step.
The important point is that a stop does not need to know the whole path. It only needs to know whom to pass to next, and the next stop carries on by looking at its own table.
Small tables linked together make a long path.

03

Choosing the Shorter Path

There is rarely only one way to a destination; there are roundabout ways and shortcuts. So which path goes into the table? The shortest one, naturally.
We have met this problem before. Finding the shortest path on a graph of points and lines, back in the algorithms area, is exactly what routing uses.
On the real internet, other factors such as line speed and how congested a route is are often weighed along with distance.

67324STUVD
Tap both ways to compare total distance

Tap the top and bottom paths to compare their total distance. The bottom path passes through more hops, but its total distance is shorter, so the bottom path is the one written into the table.

Once the shorter path is chosen and written into the table, packets heading for that destination flow down the fast path automatically from then on.
So routing does two jobs. One is finding the shortest paths and building the table; the other is passing each arriving packet on according to the table.
The first is the shortest-path search from the algorithms area; the second is choosing at the fork.

04

No Central Control Tower

Here comes the most surprising part: there is no central control tower directing all of this. Nobody anywhere holds the complete map.
Each stop looks only at its own table and decides the next step by itself. When many stops share the decisions like this instead of one place deciding everything, it is called distributed.
The stops keep trading path information with their neighbors and update their tables as they go.

SMND
Tap stop M to shut it down

Pick central control or distributed, then tap the middle stop to shut it down. Under central control the path breaks; when distributed, the neighboring stops find a detour on their own.

Even with one stop down, the path did not break, because the neighboring stops updated their tables and went around another way.
If a single central tower had been deciding every path, everything would have stopped the moment that tower stopped. Because it is distributed, the whole keeps running even when one place falls.

05

Summing Up

Routing in one line: a packet finds its way by being passed along one stop at a time. Each stop looks at its route table to choose whom to pass to next, and the table holds the shortest path.
There is no central control tower. Because each stop decides for itself, the packet keeps going by a detour even if one stop stops.

Click the key points of routing in order to wrap up

Tap the four key points in order to sum up. (choosing at the fork → route table → fastest path → distributed, no center) When all four are lit, the summary is done.

Here is the secret of why the internet so rarely goes down: nothing is left to a single central place. Countless stops each look at their own route table and pass packets along fast paths, and when something is blocked, another stop finds a detour.
Small decisions add up to an enormous road joining the whole world. The next lesson is about the help desk that turns the names we type into the address bar into number addresses.

In one lineRouting is finding the way to a destination by passing a packet along one stop at a time. Each stop (router) looks at a route table that says, for each destination, whom to pass the packet to next. When there are several paths, the shortest one is chosen. Most importantly, there is no central control tower: each stop decides for itself, so even if one stop stops, the others find a detour and the packet keeps going. Thanks to this distribution, the internet rarely breaks down.
← Networks
Was this helpful? Support seegongsik