← All posts

Subnets and CIDR without the headache

22 August 2023 · 1 min read
#networking#cloud

CIDR notation looks like maths homework, but you only need a few facts.

10.0.0.0/16 means: the first 16 bits are the network, the rest are for hosts. The smaller the number after the slash, the bigger the network.

The ones worth remembering:

  • /16: about 65,000 addresses. A typical size for a whole cloud network.
  • /20: about 4,000. A big subnet.
  • /24: 256. The classic "one subnet" size.
  • /27: 32. Small, special-purpose subnets.
  • /32: exactly one address.

Each step of the slash halves or doubles the size: a /25 is half a /24.

Two practical tips:

  • Cloud providers keep a few addresses in every subnet (usually the first four and the last one), so a /24 gives you a bit less than 256.
  • Plan for growth and avoid overlaps. If two networks might ever be connected by peering or a VPN, their ranges must not overlap. Changing a range later is painful.
T
Written by Teza Wynn Htut

Cloud and infrastructure engineer in Auckland. I write down the fixes and lessons from things I build, and make tutorial videos on YouTube.

Watch on YouTube