Skip to content
  • IP Addressing & Subnetting · Computer Networks

IP Addressing & Subnetting

LearnViaNotes @learnvianotes· 3 min read

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

FeatureIPv4IPv6
Bit length32 bits128 bits
Format4 decimal "octets" (e.g. 192.168.2.30)8 groups of hexadecimal (e.g. ABFE:F001:3210:9182:0:0:1:2)
Address space2³² ≈ 4.3 billion unique addresses2¹²⁸ ≈ 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

ClassRangeTypical use
A0.0.0.0 – 127.255.255.255Very large networks (few networks, huge host count)
B128.0.0.0 – 191.255.255.255Medium-to-large networks
C192.0.0.0 – 223.255.255.255Small networks (most common, e.g. home routers)
D224.0.0.0 – 239.255.255.255Multicast addressing
E240.0.0.0 – 255.255.255.255Reserved, 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.1 specifically 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

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report