Networking handbook · Chapter 5

Subnetting and address planning

A subnet plan divides a parent allocation into disjoint blocks. Choosing sizes requires three counts: the interfaces a LAN needs, the addresses each rounded block consumes, and the space still free in the parent.

In this guide13 sections

Introduction

A subnet plan divides a parent allocation into disjoint blocks. Choosing sizes requires three counts: the interfaces a LAN needs, the addresses each rounded block consumes, and the space still free in the parent.

Size from interface requirements

For a conventional IPv4 broadcast LAN, count every address-consuming interface, including router interfaces. Add two positions for the network and broadcast addresses, then round the result up to a power of two. If the rounded size is 2^h, the IPv4 prefix is 32 − h.

Address capacity and switch-port capacity are different. A wireless client, virtual machine or secondary interface address can consume an IP position without consuming another access-switch port. Keep the source of the host requirement in the plan.

Maintain alignment as you subdivide

Each additional prefix bit halves a parent into a lower and an upper child. A valid block begins at an integer multiple of its size. In a /24 parent, a /26 can begin at fourth octet 0, 64, 128 or 192.

Variable-length subnet masking lets different LANs receive different child sizes. In a fresh aligned parent, allocate largest first. Later small blocks can occupy the remaining boundaries. A parent containing existing allocations requires a free-interval inventory before applying this method.

Diagram

  1. Parent · 192.0.2.0/25
  2. Office · .0/26
  3. Meeting rooms · .64/27
  4. Free block · .96/27
Inside the 128-address parent, 64 addresses go to the office, 32 to meeting rooms and 32 remain. The three intervals are adjacent and disjoint.

Worked examples

Fit two multiaccess LANs into a /25

  1. The office requires 48 interface addresses and the meeting rooms require 18. Including endpoints gives totals of 50 and 20. The next powers of two are 64 and 32.
  2. Assign 192.0.2.0/26 to the office. Its conventional host range is .1–.62. Assign 192.0.2.64/27 to the meeting rooms, with host range .65–.94.
  3. The second LAN ends at .95. The parent ends at .127, leaving .96–.127, exactly 192.0.2.96/27. The spare host positions inside the first two LANs remain with those allocations.

IPv4 Subnet Calculator: Size a LAN for 28 workstations and one gateway

  1. Count 29 interface addresses. A /28 contains 16 addresses and supplies 14 ordinary LAN host positions. A /27 contains 32 and supplies 30.
  2. For 198.51.100.100/27 the fourth-octet boundaries are multiples of 32. The input falls in the block beginning at 96 and ending at 127.
  3. The interface range is 198.51.100.97 through 198.51.100.126. Assigning 28 workstations and one gateway leaves one position for another interface.

Reference table

Subnetting and address planning reference
AllocationTotal addressesConventional host positions
Office /266462
Meeting rooms /273230
Unallocated /273230 if assigned as one LAN

Configuration example

  • Parent = 192.0.2.0/25
  • Office gateway = 192.0.2.1/26
  • Meeting-room gateway = 192.0.2.65/27
  • Unallocated = 192.0.2.96/27

Common mistakes

  • Starting a /26 at .32 in a /24 because 64 addresses remain after it.
  • Counting a gateway separately after the requirement already included all interfaces.

Frequently asked questions

Why does requesting one extra interface sometimes double the allocation?

A conventional /27 has 30 host positions. Growing to 31 required interfaces crosses that threshold, so the smallest eligible power-of-two block is a /26.

How do I test the sheet for overlap?

Calculate each network's inclusive first and last addresses, sort by the first address, and verify that each following first address is greater than the previous last address.

How many IPv4 addresses are in a /27?

A /27 leaves five host bits, so the block contains 2^5 = 32 addresses. Usable host counts depend on subnet purpose and special cases such as point-to-point /31 links.

Why is a network address not always the first usable host?

In a conventional multi-access IPv4 subnet, the all-zero host portion names the network and the all-one host portion is the directed broadcast. Specialized prefixes can have different host-use rules.

Can two subnets overlap without a routing problem?

Overlapping prefixes can make route selection and address ownership ambiguous. A design should allocate non-overlapping blocks within the routing domain unless it explicitly handles overlap.

Should subnet size be rounded up or down to meet host demand?

Choose the smallest valid block that accommodates the required endpoints plus any addresses reserved by the network design. Leave room for documented growth when the plan requires it.

Why do conventional IPv4 subnets reserve two addresses?

For a typical subnet with at least two host bits, the all-zero host part identifies the subnet and the all-one host part is its directed broadcast. Point-to-point /31 links are a defined exception.

Can a /31 be used for a point-to-point IPv4 link?

Yes. RFC 3021 permits both addresses of a /31 to be used as endpoints on a point-to-point link, where a subnet and broadcast address are unnecessary.

What is the first step when splitting a parent network?

Choose child prefixes that fit the required host counts, then verify that each child starts on a valid boundary and remains entirely inside the parent allocation.

Why keep space for future growth in a subnet plan?

A plan with no room can force renumbering or fragmentation of later allocations. Documented headroom can make expansion easier, provided it does not create unnecessary waste or overlap.

How does VLSM differ from fixed-length subnetting?

Variable Length Subnet Masking assigns different prefix lengths to different subnets according to their needs. This can use address space more efficiently when host requirements vary.

Why must a subnet start on a block boundary?

A prefix fixes leading bits, so the network value must have all host bits set to zero. A misaligned address is normalized to the aligned network that contains it.

How many addresses does an IPv6 /64 contain?

It leaves 64 host bits, so the mathematical address count is 2^64. That count does not imply that a LAN should manually assign every address or that each value is used.

Should every IPv4 subnet subtract exactly two usable hosts?

That is the common rule for ordinary IPv4 multi-access subnets with enough host bits. Point-to-point /31 links and very small prefixes have special handling, so check the intended use.

What should be checked after a VLSM plan is calculated?

Verify every child prefix is aligned, contained in the parent, non-overlapping, large enough for its requirement, and consistent with the site policy and reserved addresses.

Further learning and references