Back to the map

Module 11 · Internet layer · Lesson 1 of 5

IP addressing and subnetting

How IPv4 addresses are structured, what a /24 means, how to split a block into subnets, and how a host decides whether a destination is local or must go through the router. The arithmetic you need to plan a VPC without running out.

CoreMust-knowJunior 12 min Updated Nov 2026

Why it matters

Every cloud network starts with someone picking a CIDR block, and that choice is surprisingly hard to change later. Pick too small and the cluster cannot scale; overlap with another network and you can never peer them; misread a mask and two services cannot reach each other. Subnetting is also the logic every host runs on every packet: "is this destination on my network, or do I send it to the router?" A few minutes of binary arithmetic prevents a class of outages that otherwise take days to untangle.

The idea

An IPv4 address is 32 bits, written as four decimal bytes: 10.20.30.40. It splits into a network prefix (which network) and a host part (which machine on it). The split is given by the prefix length in CIDR notation: 10.20.30.0/24 means the first 24 bits are the network and the last 8 identify hosts. The same thing as a mask is 255.255.255.0.

1020300–255network: first 24 bitshost: last 8 bits10.20.30.0 = network · 10.20.30.255 = broadcast · 254 usable hosts
A /24 fixes the first three bytes as the network; the last byte numbers up to 256 addresses, of which the first and last are reserved in classic IP.

Sizing in one table

PrefixAddressesTypical use
/321A single host route or allow-list entry
/2816A tiny subnet; minimum in some clouds
/24256A classic LAN or small subnet
/204,096A subnet for a node pool or a zone
/1665,536A whole VPC or campus
/816.7 million10.0.0.0/8, the largest private block
Each bit off the prefix doubles the size: addresses = 2 ^ (32 − prefix). Clouds reserve a few addresses per subnet (AWS reserves five).

Local or remote?

A host knows its own address and prefix. To send a packet, it ANDs the destination with its mask and compares the result with its own network. If they match, the destination is on the same link and the host ARPs for it directly. If not, it sends the packet to its default gateway (the router), which forwards it on. A wrong mask makes a host think a remote machine is local (it ARPs and gets no answer) or a local machine is remote (traffic detours through the router), and both look like flaky connectivity.

  1. 1

    Host 10.20.30.40/24 sends to 10.20.30.99

    Masked with /24, both give 10.20.30.0: same subnet. ARP for 10.20.30.99 and send directly.
  2. 2

    Host 10.20.30.40/24 sends to 10.20.31.5

    10.20.31.0 differs from 10.20.30.0: different subnet. Send the frame to the gateway's MAC.
  3. 3

    Same host with a mistaken /16 mask sends to 10.20.31.5

    It now believes 10.20.31.5 is local, ARPs for it, gets no answer, and the connection fails, even though routing is fine.

Splitting a block

Subnetting borrows host bits to make more, smaller networks. A 10.0.0.0/16 VPC can be cut into 16 subnets of /20 (4,096 addresses each): 10.0.0.0/20, 10.0.16.0/20, 10.0.32.0/20 and so on, each starting on a multiple of its size. A sensible cloud layout gives each availability zone a public and a private subnet, sized for the largest thing that will live there (Kubernetes pods often get their own IP each, which consumes addresses fast), and leaves unused space for growth.

Private ranges and planning

Three ranges are reserved for private networks and never routed on the internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Most VPCs, offices and home networks use them, which is exactly why overlaps happen: two companies merging, a VPC peering request, a VPN to a partner, and both sides used 10.0.0.0/16. Overlapping ranges cannot be routed between without NAT tricks. Planning rules: allocate non-overlapping blocks per environment and region from one central plan, size for pods and future growth, and record it.

MistakeConsequenceAvoid by
VPC sized /24 for a Kubernetes clusterPods exhaust IPs; nodes cannot scheduleSize from pods per node × nodes × headroom
Every team picks 10.0.0.0/16VPCs cannot be peered or connected laterCentral IP address management
Subnet boundary not aligned to its sizeOverlapping or invalid subnetsStart each subnet at a multiple of its size
Wrong mask on a hostSome peers unreachable, others detourConfiguration by DHCP or infrastructure code

Trade-offs

Large blocks give room to grow and waste address space you might need elsewhere; small blocks conserve space and risk exhaustion that forces painful re-addressing. Many small subnets give isolation and finer security boundaries at the cost of more routing entries and planning. IPv4's 4.3 billion addresses ran out globally years ago, which is why private ranges plus NAT dominate and why IPv6, later in this module, exists.

In an interview

Show the arithmetic briefly: "The VPC is a /16 from our central plan, split into three /20 private subnets, one per zone, for nodes and pods, plus three /24 public subnets for load balancers. At about 30 pods per node, a /20 holds roughly 130 nodes per zone, which is our ceiling with headroom." That combination of sizing and non-overlap is what interviewers listen for.

Check yourself

A Kubernetes cluster in a /24 subnet stops scheduling new pods at about 250 pods even though nodes have spare CPU and memory. What is the cause?

IP addressing and subnetting · Backplane