How packets get routed, classed, and divided across the global network.
Routing fundamentals
Every router maintains a routing table (a data structure mapping destination addresses to the next hop) — when computer A sends data to computer B, it doesn't go directly; it's relayed hop-by-hop through a chain of routers, each forwarding it one step closer using its own table, until it reaches the destination.
In graph terms: routers are nodes, the links between them are edges — and finding the best path through this graph is a routing/shortest-path problem.
The component that builds and maintains these routing tables is referred to as the control plane of the network.
IPv4 vs IPv6
| Feature | IPv4 | IPv6 |
|---|---|---|
| Bit length | 32 bits | 128 bits |
| Format | 4 decimal "octets" (e.g. 192.168.2.30) | 8 groups of hexadecimal (e.g. ABFE:F001:3210:9182:0:0:1:2) |
| Address space | 2³² ≈ 4.3 billion unique addresses | 2¹²⁸ ≈ 3.403 × 10³⁸ unique addresses |
| Adoption challenge | — | Not backward compatible with IPv4; requires significant ISP/hardware migration |
An IPv4 address like 192.168.2.30 splits into a network/subnet ID (e.g. 192.168.2) identifying which network the device belongs to, and a device/host address (the final 30) identifying the specific machine within that network.
IPv4 address classes
| Class | Range | Typical use |
|---|---|---|
| A | 0.0.0.0 – 127.255.255.255 | Very large networks (few networks, huge host count) |
| B | 128.0.0.0 – 191.255.255.255 | Medium-to-large networks |
| C | 192.0.0.0 – 223.255.255.255 | Small networks (most common, e.g. home routers) |
| D | 224.0.0.0 – 239.255.255.255 | Multicast addressing |
| E | 240.0.0.0 – 255.255.255.255 | Reserved, experimental use |
Subnet masking
For a Class C address, the default mask is 255.255.255.0 — the first three octets identify the network, the last identifies the host. CIDR notation (e.g. /24) is the modern compact way to express this, where the number indicates how many leading bits are the network portion.
Reserved & special addresses
127.0.0.0/8— the loopback range.127.0.0.1specifically is "localhost" — it lets a device contact itself, useful for a machine acting as both client and server during local development/testing.
Anatomy of an IP packet header
Every IP packet carries a 20-byte header containing:
Version (IPV)
Header Length
Identification
Flags
Protocol
Checksum
Source Address
Destination Address
TTL
Middleboxes — Firewalls
A firewall is an extra device sitting between your trusted internal network and the broader, untrusted internet, filtering traffic based on configurable rules.
Filters by source/destination address
Filters by port number
Filters by protocol and packet flags