Skip to content
Optimal Lab

DevOps · interactive

IP addresses, subnets and CIDR

An IPv4 address is 32 bits. The number after the slash says how many of them are fixed for the network; the rest number the hosts inside it. Fewer host bits, smaller network.

10.0.0.0/16

0000101000000000hhhhhhhhhhhhhhhh

Colored: 16 network bits. h: 16 host bits.

Mask
255.255.0.0
Addresses
65,536
Usable hosts
65,534
First
10.0.0.1
Last
10.0.255.254
Broadcast
10.0.255.255

10.0.0.0/16 split into /18: 4 subnets

  • 10.0.0.0/18 (16,384)
  • 10.0.64.0/18 (16,384)
  • 10.0.128.0/18 (16,384)
  • 10.0.192.0/18 (16,384)

Is it inside 10.0.0.0/18?

  • 10.0.0.5 ✓
  • 10.0.63.200 ✓
  • 10.0.64.1 ✗
  • 10.1.0.1 ✗
  • 192.168.1.10 ✗

/16 leaves 16 host bits: 2^16 = 65,536 addresses, 65,534 usable.

Split the /16 into

  1. 1

  2. 2

    /16 means the first 16 bits are the same for every address in the network. The mask 255.255.0.0 says the same thing.

    Each extra prefix bit halves the size.

  3. 3

  4. 4

In production

Tools and technologies

Every cloud network starts with a CIDR block.

Not tied to one language — use these names when you search docs or design a system.