1st Principles

Networking · 30 min read

IP Addresses

Numeric locators that identify network interfaces for routing: how address structure, prefixes, and public versus private space make a global map computable.

Why this exists

Packets need a destination. Without a shared addressing plan, routers cannot decide where to forward next, and independently operated networks cannot interconnect.

IP addresses provide global (and privately reusable) coordinates so billions of interfaces can be located, aggregated into prefixes, and reached across networks that do not trust or configure each other host by host.

Addressing is not identity. It is a locator system optimized for aggregation and forwarding. Confusing those jobs produces brittle security and broken mobility stories.

Axioms & primitives

  1. 01An address names an attachment point on a network, not a person or eternal identity.
  2. 02Routing aggregates addresses into prefixes (CIDR) so tables stay finite.
  3. 03IPv4 is 32-bit; IPv6 is 128-bit; both are locator spaces with structure.
  4. 04Public and private address spaces serve different reachability goals.
  5. 05Uniqueness is scoped: private addresses need translation or tunneling to meet the public internet.
  6. 06Longest-prefix match makes more-specific routes win over coarser ones.

Learning objectives

After this lesson you should be able to:

  • Read CIDR notation and explain what a prefix means for routing and for host counts at a conceptual level.
  • Contrast IPv4 exhaustion pressures with IPv6 abundance without claiming migration is finished everywhere.
  • Explain why an IP address is a poor authentication credential.
  • Distinguish interface locator from hostname (DNS) and from port (transport).
  • Identify special-purpose ranges (loopback, link-local, documentation, private) and why they exist.

Progressive depth

Read the layers in order for a full explanation. Or open the layer you need.

01

Intuition

Routers are postal sorting centers. They do not need to know the letter's essay, only the address block that points toward the next center.

An IP address is the writing on the envelope. Without it, the network has nowhere to send the packet. With a well-chosen hierarchical address, most routers only need coarse directions until the packet nears its destination.

When your laptop moves from home Wi-Fi to a cafe, its address usually changes because its attachment point changed. The name of your favorite site did not change. That is why DNS exists as a separate layer of indirection.

02

Formal shape

IPv4 addresses are 32-bit values usually written dotted-decimal (203.0.113.10). IPv6 addresses are 128-bit values written in hex with compression rules (2001:db8::1).

CIDR notation (203.0.113.0/24) means the first 24 bits identify the network prefix and the rest identify hosts inside it. A /32 is a single IPv4 host route; a /128 is a single IPv6 address. Longest-prefix match decides which route wins when multiple prefixes cover an address.

Special ranges exist: loopback (127.0.0.0/8, ::1), link-local (169.254.0.0/16, fe80::/10), private IPv4 (RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), unique local IPv6 (fc00::/7), multicast, and documentation ranges (RFC 5737 / RFC 3849) used in examples.

Interface configuration pairs an address with a prefix length and typically a default gateway. Subnet masks are the older way to write the same prefix information.

03

Worked examples

Your laptop at home might be 192.168.1.42/24 (private). Your router holds a public address from the ISP. Outbound packets are rewritten so the public internet sees the router's address (see NAT).

ping and traceroute exercise reachability along hops. They answer "can packets get there?" not "is the website application healthy?" A successful ping to an IP with a dead HTTP service is still a useful split.

When DNS returns an A/AAAA record, your browser opens a transport connection to that locator on a chosen port. The name was only a lookup key.

CIDR drill: 10.0.0.0/8 contains far more host capacity than 10.1.2.0/24. A route to 10.1.2.0/24 is more specific than 10.0.0.0/8, so traffic for 10.1.2.9 follows the /24 when both exist.

04

Edge cases

Anycast announces one address from many places; routing delivers you to a nearby instance. Useful for DNS and CDNs; confusing if you assume one host one address.

Geolocation by IP is probabilistic and often wrong. Mobile networks renumber frequently. Multi-homed hosts have multiple addresses with different reachability and source-address selection rules that surprise application authors.

IPv4 and IPv6 can run in dual stack. Happy Eyeballs algorithms race connections so users do not wait forever on the broken stack.

Using IP allowlists as the only security control fails under NAT, proxies, and spoofing (where not filtered). Prefer cryptographic identity for trust.

Mental models

  • Street address vs name

    DNS names are friendly labels. IP addresses are delivery coordinates that can be reassigned when you move networks.

  • Postal code aggregation

    Routers do not store a row per house on earth. They store regions (prefixes), just as sorting centers use postal codes.

  • Hotel room numbers

    Private addresses are like room numbers unique inside the hotel. Outside, you need the hotel's public address plus a way to find the room (NAT/port mapping).

  • Library call numbers

    Structure in the number helps shelving. Prefix hierarchy helps routing. Random flat identifiers would not aggregate.

Common misconceptions

  • Myth

    Your IP address is your permanent identity.

    Reality

    It often changes, is shared via NAT, and is a poor substitute for authentication. Locators are not identities.

  • Myth

    IPv6 is just 'more IPv4 with colons.'

    Reality

    Larger space enables different operational habits (less NAT necessity, different autoconfiguration), though many apps still assume old constraints.

  • Myth

    Every device on earth already has a unique public IPv4 address.

    Reality

    IPv4 scarcity led to widespread private addressing and NAT. Many devices share public addresses.

  • Myth

    If two hosts have different IPs, they are definitely different machines.

    Reality

    Virtual hosts, anycast, load balancers, and dual-stack interfaces break that intuition.

Exercises

Work these without looking up answers first. Check yourself against the intent notes.

  1. Exercise 01

    Explain what 10.0.0.0/8 means, and whether two companies can both use 10.0.0.5 internally without conflict on the public internet.

    What good looks like

    Private space reuse is fine internally; conflict appears when merging networks or needing unique public reachability without NAT/VPN design.

  2. Exercise 02

    A server has addresses 203.0.113.5 and 2001:db8::5. A client only has IPv4. What happens when the client tries to connect?

    What good looks like

    Client needs an IPv4 path (or translation). Dual-stack server alone does not help an IPv4-only client reach IPv6.

  3. Exercise 03

    Why is 'block this attacker IP forever' a weak long-term strategy for a public web app?

    What good looks like

    Addresses are reused/shared; attackers rotate; NATs hide many users behind one IP; false positives punish sharers. Need auth, rate limits, and better identity.

Sources & further reading

External references. Prefer primary documents and clear explainers.

Uncertainty notes

  • Operational IPv6 adoption varies by network; treat dual-stack realities as empirical, not as a finished migration story.

Go deeper on your own

These picks go past the foundation in this lesson. Use them when you want a primary spec, official docs, or a longer walkthrough.