Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
VPC — Your Private Network  ›  Lesson

CIDR Blocks — Sizing Your Network

CIDR Blocks 15 minA CIDR block such as 10.0.0.0/16 names a range of IP addresses, where the number after the slash is how many leading bits are fixed and the range holds 2 to the power of the remaining bits.

CIDR Blocks — Sizing Your Network

Inkwell is creating its own private network in AWS, a VPC, and the first box asks for an "IPv4 CIDR block". Type something too small and the network fills up; type something that clashes with the office network and connecting the two later becomes painful. Two minutes of arithmetic now saves a rebuild later.

The rule

The slash counts fixed bits; the rest are yours: 2 to the 32 minus slash.

An IPv4 address is 32 bits, written as four numbers from 0 to 255. CIDR notation writes a range as a starting address and a slash:

10.0.0.0/16
  • The /16 says the first 16 bits are fixed: every address in the range starts 10.0.
  • The other 32 − 16 = 16 bits are free, so the range holds 2 to the 16th, which is 65,536 addresses, from 10.0.0.0 to 10.0.255.255.

Handy values to know by heart:

  • /16 → 65,536 addresses (the largest block AWS allows for a VPC)
  • /20 → 4,096
  • /24 → 256 (the last number runs 0 to 255)
  • /28 → 16 (the smallest block AWS allows)

Each extra bit after the slash halves the range; each bit fewer doubles it.

In a VPC, AWS reserves five addresses in every subnet: the first four (network address, VPC router, DNS, and one kept for future use) and the last. So a /24 subnet gives 256 − 5 = 251 usable addresses.

Use the private ranges set aside for internal networks, 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16, and pick a block that does not overlap any network you may connect to later, such as your office or another VPC.

The shortcut

To size any block: subtract the slash from 32, raise 2 to that power, and subtract 5 if it is a subnet.

Sizing Inkwell's networkStep 1 of 4
  1. The VPC

    10.0.0.0/16: 32 − 16 = 16, and 2 to the 16th is 65,536 addresses.

The trap is reading the slash backwards: a bigger number after the slash means a smaller network. A /28 is tiny; a /16 is huge.

Drills

Answer fast — trust the rule.

quick drill

How many addresses does a /24 block contain?

quick drill

Which block is larger?

quick drill

How many addresses can Inkwell actually assign in a /28 subnet in AWS?

quick drill

Inkwell's office network is 10.0.0.0/16 and it will connect by VPN. Which VPC block is safe?

Remember

  • The slash counts fixed bits; the range holds 2 to the power of (32 minus slash).
  • Shortcut: subtract from 32, power of two, minus 5 per subnet in AWS.
  • Trap: a bigger slash number is a smaller network, and never overlap networks you will connect.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainPlan Inkwell's address space

Inkwell is creating its VPC with the block 10.0.0.0/16 and wants subnets of /24. Work out how many addresses the VPC holds, how many a /24 subnet holds, how many of those Inkwell can actually use in AWS, and why the VPC block should not overlap with the office network 192.168.1.0/24 or any other network they may connect later.