Book an info sessionInfo session

Subnetting practice: VLSM, CIDR, calculating hosts and networks

Cisco CCNA Preparation · lesson 8 of 36 · 25 min

Why Subnetting Matters

Subnetting divides a large IP address block into smaller networks. It conserves IP addresses, improves security (isolates traffic), and reduces broadcast domains. The CCNA exam tests subnetting extensively — you must be able to calculate subnet addresses, host ranges, and broadcast addresses quickly.

Exam tip

Practice subnetting until you can do it in your head. The exam does not provide a calculator for subnetting questions. Know the powers of 2 (2, 4, 8, 16, 32, 64, 128, 256) and subnet mask values by heart.

CIDR Notation and Subnet Masks

CIDR (Classless Inter-Domain Routing) notation expresses a network as an IP address followed by a prefix length: 192.168.1.0/24. The prefix length is the number of 1-bits in the subnet mask.

Formula

Hosts per subnet = 2^(32 – prefix) – 2. Subtract 2 for network address and broadcast address. Number of subnets = 2^(bits borrowed from host portion).

Subnetting a /24 — Worked Example

Subnet 192.168.10.0/24 into 4 equal subnets

Determine bits to borrow Need 4 subnets → 2² = 4, so borrow 2 bits from the host portion. Calculate new prefix /24 + 2 borrowed bits = /26. Subnet mask = 255.255.255.192. Calculate hosts per subnet 32 − 26 = 6 host bits. 2⁶ = 64 addresses. 64 − 2 = 62 usable hosts per subnet. Calculate block size 256 − 192 = 64. Each subnet is a block of 64 addresses. List all four subnets Subnet 1: .0/26 (.1–.62, broadcast .63). Subnet 2: .64/26 (.65–.126, broadcast .127). Subnet 3: .128/26 (.129–.190, broadcast .191). Subnet 4: .192/26 (.193–.254, broadcast .255).

VLSM — Variable Length Subnet Masking

VLSM allows different subnets within the same network to use different prefix lengths — allocating exactly the right number of addresses for each subnet rather than wasting addresses with fixed-size subnets.

VLSM design rule: Always subnet the largest requirement first, then work down to the smallest. This prevents address space fragmentation.

Knowledge Check — 10 Questions

Subnetting: VLSM and CIDR

How many usable host addresses are in a /27 subnet?

  • 14
  • 30
  • 62
  • 126

Answer: 30
/27 = 32 – 27 = 5 host bits. 2^5 = 32 addresses. 32 – 2 = 30 usable hosts.

What subnet mask corresponds to /26?

  • 255.255.255.128
  • 255.255.255.192
  • 255.255.255.224
  • 255.255.255.240

Answer: 255.255.255.192
/26 = 26 ones in the mask. Last octet: 11000000 = 192. Mask = 255.255.255.192.

You need to subnet 10.0.0.0/24 into at least 8 subnets. What is the minimum prefix length?

  • /25
  • /26
  • /27
  • /28

Answer: /27
Need 8 subnets → borrow 3 bits (2^3 = 8). /24 + 3 = /27.

What is the broadcast address of 192.168.1.64/26?

  • 192.168.1.127
  • 192.168.1.128
  • 192.168.1.95
  • 192.168.1.191

Answer: 192.168.1.127
/26 block size = 64. Starting at .64, the block ends at .64 + 64 – 1 = .127. Broadcast = last address = 192.168.1.127.

Which prefix is most efficient for a point-to-point WAN link needing only 2 host addresses?

  • /28
  • /29
  • /30
  • /31

Answer: /30
/30 provides 2 usable hosts (2^2 – 2 = 2) — exactly right for a point-to-point link. /31 is also valid per RFC 3021 but /30 is the traditional CCNA answer.

What is the key advantage of VLSM over fixed-length subnetting?

  • Faster routing
  • Allocates exactly the right number of addresses per subnet, reducing waste
  • Simpler configuration
  • Better security

Answer: Allocates exactly the right number of addresses per subnet, reducing waste
VLSM lets you use a /30 for a 2-host WAN link and a /24 for a large LAN — no wasted addresses from oversized subnets.

How many subnets can you create from 172.16.0.0/16 using a /20 prefix?

  • 8
  • 16
  • 32
  • 256

Answer: 16
Bits borrowed = 20 – 16 = 4. 2^4 = 16 subnets.

The formula for usable hosts per subnet is 2^(32 – prefix) minus _____.

Answer: 2
Subtract 2 for the network address (all host bits 0) and broadcast address (all host bits 1). These cannot be assigned to hosts.

What is the network address of 10.1.1.130/25?

  • 10.1.1.0
  • 10.1.1.128
  • 10.1.1.129
  • 10.1.1.255

Answer: 10.1.1.128
/25 block size = 128. 130 falls in the second block (128–255). Network address = 10.1.1.128.

In VLSM design, which subnet should you allocate first?

  • The smallest subnet
  • The largest subnet
  • The subnet with the most routers
  • Any subnet — order does not matter

Answer: The largest subnet
Always allocate the largest subnet first to prevent fragmentation of the address space. Work from largest to smallest.


Previous lesson: TCP vs UDP, wireless principles (channels, SSID, RF, encryption), switching concepts
Back to Cisco CCNA Preparation
Next lesson: ARP, ICMP, DNS, DHCP — how they work together in a network