Subnetting Guide: IPv4 Subnets Step by Step
SubnettingIPv4 SubnetsGuide

Subnetting Guide: IPv4 Subnets Step by Step

Learn IPv4 subnetting step by step: network and broadcast addresses, masks, CIDR prefixes, block size, host ranges, FLSM, VLSM, worked examples, and validation.

FLSM methodVLSM methodIP Addressing

Introduction

This guide teaches IPv4 subnetting from the underlying address-and-prefix relationship through practical network planning. If IP addresses, masks, or CIDR notation are still unclear, begin with the IP Addressing guide.

Core concepts

Address, mask, prefix, network address, broadcast address, and usable host range.

Two methods

FLSM for equal-sized subnets and VLSM for variable-sized allocation.

Practical method

Binary boundaries, block size, examples, validation, and common mistakes.

What a subnet is

A subnet is a logical division of an IP network into smaller address blocks. Every subnet is described by a network prefix, and devices use that prefix to decide whether a destination is local or must be reached through a router.

Subnetting is useful for segmentation, address planning, VLAN design, routing boundaries, security policy, fault isolation, and reducing the size of Layer 2 broadcast domains.

Key concepts before calculating

Network address

The first address of a conventional IPv4 subnet identifies the subnet itself and is not assigned to a normal host interface.

Broadcast address

The last address of a conventional IPv4 subnet is the directed broadcast address. This convention changes for a /31 point-to-point subnet, where both addresses can be used by the two endpoints under RFC 3021.

Usable range

For most traditional host subnets, usable addresses sit between network and broadcast. A /32 is a single-host prefix rather than a multi-host subnet.

IPv4 structure and binary boundaries

IPv4 contains 32 bits. The prefix tells you how many bits describe the network. The remaining bits identify addresses inside that network. Borrowing additional host bits makes the prefix longer and creates more, smaller subnets.

A /24 has 8 host bits and therefore 256 total addresses. A /26 has 6 host bits and 64 total addresses. A /30 has 2 host bits and 4 total addresses.

The power-of-two structure explains why subnet sizes are 256, 128, 64, 32, 16, 8, 4, 2, and 1 addresses as the prefix length increases.

Subnet masks and CIDR

IPv4 masks and CIDR prefixes express the same boundary. For example, /25 is 255.255.255.128, while /27 is 255.255.255.224.

When working by hand, identify the interesting octet: the first mask octet that is neither 255 nor 0. The block size in that octet is 256 - maskValue. For a /27, the interesting octet is 224 and the block size is 32.

Finding network, broadcast, and host range

Suppose the address is 192.168.10.77/27. A /27 has a block size of 32, so network boundaries in the last octet are 0, 32, 64, 96, 128, 160, 192, and 224. The value 77 falls in the 64–95 block.

  • Network: 192.168.10.64
  • Broadcast: 192.168.10.95
  • Conventional usable range: 192.168.10.65–192.168.10.94
  • Total addresses: 32
  • Conventional usable hosts: 30

FLSM vs VLSM

FLSM divides a parent network into equal-size children. It is predictable and fast when every segment needs the same capacity. VLSM assigns different prefix lengths according to actual requirements and is normally more address-efficient.

Learn the pattern first with the FLSM guide, then continue with VLSM.

Practice method

For each exercise, write down the parent prefix, required number of subnets or hosts, selected child prefix, block size, and every network boundary. Then verify that no child subnet escapes the parent network and that no two blocks overlap.

Example: four equal subnets from a /24

Four equal subnets require borrowing two bits, so the new prefix is /26. The resulting networks are .0/26, .64/26, .128/26, and .192/26.

Example: variable requirements

If one LAN needs about 100 hosts and another needs 20, assigning both a /25 wastes significant address space. VLSM can allocate a /25 to the larger LAN and a /27 to the smaller one, then continue with the remaining aligned space.

Common subnetting mistakes

  • Confusing total addresses with conventional usable hosts.
  • Starting a subnet at a value that is not aligned to its block size.
  • Forgetting that the parent prefix limits the entire allocation.
  • Mixing dotted-decimal masks and prefix lengths incorrectly.
  • Applying the traditional minus-two rule blindly to /31 or /32.
  • Allocating smaller VLSM blocks first and fragmenting space needed by larger networks.

Use tools to verify, not to skip the method

SubnetMaster calculators can validate networks, ranges, overlaps, FLSM, and VLSM. Calculate at least a few examples by hand first. Once you understand the binary boundaries, tools become excellent for checking plans and avoiding transcription errors.

Next step

Continue with FLSM for equal-size subnetting and then VLSM for realistic variable-size planning.