EC-11.4 Addresses and Routing
en
What this is and why it exists
This is the layer that makes a network of networks possible, and it is where the internet's actual design decisions become visible.
It also pays off more directly in ordinary work than anything else in the module. Almost every practical connectivity problem a graduate meets is an addressing or routing problem. The ones that are not are usually identified by ruling those out first.
The vocabulary
- Hierarchical address — an address whose leading part names a region and whose trailing part names a machine within it.
- Prefix — the leading bits of an address that name the network.
- Prefix length — how many of those leading bits count.
- Subnet — a network formed by extending a prefix and splitting a range.
- Forwarding — the per-packet decision about which way to send it.
- Routing — the process by which the forwarding tables are built.
- Longest prefix match — the rule that a more specific entry wins.
- Hop limit — a counter reduced at each router, stopping a packet circling forever.
- Address translation — rewriting addresses at a border between two ranges.
The mental model
Start with why a second kind of address was needed at all. A hardware address identifies a device and says nothing about where it is, so a router would need one table entry per device on earth.
A hierarchical address encodes where. All the machines in one place share a leading prefix, so a router far away holds one entry covering all of them. That single property is what makes routers possible at internet scale. It is also why the address you are given depends on where you connect rather than on your hardware.
The prefix length says where the boundary falls. A prefix length of twenty-four means the first twenty-four bits name the network and the remaining bits name machines inside it. Subnetting is choosing to move that boundary rightwards, splitting one range into several smaller ones.
Working with this is arithmetic and it repays practice. Given an address and a prefix length, you should be able to state the network's first address, its last, and how many machines fit. Given a requirement for several networks of stated sizes, you should be able to divide a range between them.
Forwarding is one decision, made independently for every packet. The router compares the destination against every entry in its table and uses the entry with the longest matching prefix.
That one rule is what makes a specific route override a general one. A default route matches everything with a prefix length of zero, and any real entry beats it. Nothing else is needed to express exceptions.
Routing is how those tables get filled, and there are two families. In one, each router tells its neighbours what it can reach and at what cost, and each router believes what it is told. Simple, and it converges slowly and can believe stale information.
In the other, every router learns the whole map and computes its own shortest paths. Faster to converge and correct by construction, and it needs every router to hold the map, which limits how large one such region can be.
Both are in use, at different scales, with the first family used between organisations and the second inside them.
Three practical mechanisms complete the layer. A packet larger than the next link can carry must be split or refused. Modern practice is to refuse it and tell the sender to send smaller ones. A hop limit reduced at each router turns a routing loop into a discarded packet rather than a permanent flood. And a companion protocol carries both of those reports back to the sender, which is what makes path tracing and reachability testing possible.
Finally, the internet as it actually is rather than as designed. Addresses ran short, so most networks use a private range and rewrite addresses at their border.
The consequence is that most machines are not directly reachable from outside. This breaks the original design, in which any machine could address any other. It is the direct cause of a long list of awkward problems. Services that cannot accept incoming connections. Protocols that carry addresses inside their own messages. And the machinery invented to work around both.
Knowing this is what turns a mysterious connectivity failure into a diagnosable one.
What you should now be able to explain or do
- Explain why hierarchical addressing is what makes routing at scale possible.
- Compute the range, size and boundaries of a network from an address and prefix length.
- Divide an address range into subnets of required sizes.
- Apply longest prefix match to a forwarding table, including a default route.
- Compare the two families of routing protocol and say where each is used.
- Explain address translation and name two problems it causes.
Check yourself
Why can a router hold one entry for thousands of machines?
Because they share a leading prefix. Hierarchical addressing means an entry can cover a whole region, which a flat address space could never allow.
A table has a default route and an entry for a longer prefix that also matches. Which is used?
The longer prefix. Longest prefix match is the forwarding rule, and it is what lets a specific exception override a general route.
What does the hop limit prevent?
A packet circling forever in a routing loop. The counter falls at each router and the packet is discarded at zero, with a report sent back to the sender.
Name two problems caused by address translation.
Machines behind it cannot accept incoming connections directly, and protocols that carry addresses inside their own messages break unless the translator understands them.
Go deeper
We haven't checked most of these for screen reader use yet.