4.3.13 · D1Computer Networks

Foundations — Routing — forwarding table, routing table

1,720 words8 min readBack to topic

Before you can read the parent note Routing — forwarding & routing tables, you need every symbol it silently assumes. We build each from zero: plain meaning → picture → why the topic needs it. Read top to bottom; nothing appears before it is earned.


1. A bit — the smallest possible fact

Why the topic needs it: IP addresses, masks, and prefixes are all just rows of these switches. "Longest prefix match" literally means "how many leading switches agree". Without bits, none of it is defined.

Figure — Routing — forwarding table, routing table

2. A byte and the dotted-decimal address

Why the topic needs it: Every packet carries a 32-bit destination address . The parent note's is exactly this row of 32 switches.


3. Splitting an address: network part vs host part

Figure — Routing — forwarding table, routing table

Why the topic needs it: A forwarding table stores prefixes, not single addresses. 192.168.1.0/24 covers a whole block of 256 addresses in one line. "Longest prefix match" is a contest over these values.


4. The subnet mask — a stencil for the network bits

Why the topic needs it: The parent's matching test uses to erase host bits. Without the mask you cannot separate "which neighbourhood" from "which house".


5. The AND operation () — erasing with the stencil

Figure — Routing — forwarding table, routing table

6. The matching condition, now fully readable

Now every symbol in that line is earned:

  • = the 32-bit destination (Section 2),
  • = a stored prefix and its length (Section 3),
  • = the stencil built from (Section 4),
  • = the erase operation (Section 5).

7. Control plane vs data plane — two rooms, two speeds

Why the topic needs it: The parent's whole "two books" idea is this split. The routing table lives in the control plane; the forwarding table (FIB) lives in the data plane.


Prerequisite map

Bit: 0 or 1

Byte: 8 bits

IPv4 address: 32 bits, dotted decimal

Network part vs host part

Prefix P and length L

Subnet mask M: L ones then zeros

Bitwise AND erases host bits

Match test: D and M equals P and M

Longest prefix match

Forwarding decision: pick exit door

Control plane vs data plane

Each arrow means "you must own the top box before the bottom box makes sense." Follow it and you arrive exactly at the parent note's forwarding decision.


Equipment checklist

Test yourself — you should be able to answer each without peeking.

What is a bit and what two values can it hold?
The smallest unit of information; it holds either 0 or 1.
How many bits are in a byte, and what range of numbers can one byte show?
8 bits; values 0 through 255 (that is patterns).
How many bits make an IPv4 address, and how do we write it for humans?
32 bits, written as four bytes in dotted-decimal like 10.20.30.40.
What does the prefix length in P/L count?
The number of leading bits that belong to the network part.
What shape does a subnet mask have for a given ?
ones followed by zeros.
What does bitwise AND with a 0 do to a bit? With a 1?
AND with 0 forces the bit to 0 (erases it); AND with 1 keeps the bit unchanged.
Why do we AND the address with the mask instead of adding?
AND keeps network bits and cleanly erases host bits; addition would carry and corrupt the bits.
State the match condition for address against prefix .
, where is the mask built from .
Does a larger prefix length mean a bigger or smaller network?
Smaller — more network bits means fewer host bits.
Which plane holds the forwarding table?
The data plane (the fast "doing" room).