Lesson

Subnetting Fundamentals

Learning objective

Calculate network boundaries, usable ranges, broadcast addresses, and host capacity for common IPv4 prefixes.

Learning objective

Calculate an IPv4 subnet's network boundary, usable range, broadcast address, and capacity, then decide whether two hosts can communicate directly.

Why subnetting exists

Subnetting divides an IPv4 address block into smaller, deliberate network boundaries. It helps an organization assign addresses, limit broadcast scope, and tell hosts when to send locally or use a router. A subnet is a Layer 3 address boundary; a VLAN is a Layer 2 broadcast domain. They are commonly mapped one-to-one, but they are not the same thing.

Prefix length and subnet mask

A CIDR prefix such as /26 says that the first 26 bits are network bits. The remaining six are host bits. The equivalent mask is 255.255.255.192, whose binary form contains 26 contiguous ones followed by six zeros. Class A, B, and C defaults are not needed for this calculation.

Network and host portions

Apply the mask to the address. Bits under mask ones identify the network; bits under zeros vary inside that network. Two addresses are in the same subnet only when applying their configured prefix produces the same network address.

Interactive subnet boundary

Reveal the subnet boundary

Choose an address scenario

192.0.2.130/26

Step 1 of 6: Read the address and prefix

Mask: 255.255.255.19211111111.11111111.11111111.11000000Network bits: 26Host bits: 6
Interesting octet
4
Block size
64
Network
192.0.2.128
First usable
192.0.2.129
Last usable
192.0.2.190
Broadcast
192.0.2.191

A repeatable calculation method

Find the first mask octet that is not 255. This is the interesting octet. Subtract its mask value from 256 to get the block size. List multiples of that block size; the nearest multiple at or below the address is the network boundary, and the next multiple begins the following subnet.

Network, usable range, broadcast, and capacity

The network address is the first address in a traditional subnet. The address immediately before the next boundary is its broadcast address. Addresses between them form the traditionally usable host range. With h host bits there are 2^h total addresses and, for ordinary prefixes, 2^h - 2 traditionally usable addresses.

Interactive subnet scenarios

Solve a practical subnet scenario

Scenario 1 of 5

Which /26 subnet contains 192.0.2.130?

Special prefixes: /31 and /32

Do not subtract two blindly. A /31 can use both addresses on a modern point-to-point link and has no broadcast address. A /32 identifies exactly one address, often as a host route or loopback reference, so it has no ordinary host range or broadcast address.

Local delivery or the default gateway

A host applies its own mask to its address and the destination. Matching network addresses mean on-link delivery; different results mean the packet normally goes to the default gateway. This calculation happens before ARP resolves the selected local next hop.

Inspect subnet evidence

On Windows, compare ipconfig, Get-NetIPAddress, and Get-NetRoute. On Linux, compare ip address and ip route. Record the active interface, address, prefix, derived network, and default route. A displayed address alone does not prove that its mask or gateway is correct.

Practice subnet planning

For each /24 through /30 example, write the mask, block size, network address, broadcast address, usable range, and capacity before checking the result. Always verify that the chosen host is neither the traditional network nor broadcast address.

Troubleshoot subnetting methodically

  1. Confirm the address and prefix on the interface carrying traffic.
  2. Calculate each endpoint's network address independently.
  3. Check for an invalid network or broadcast host assignment.
  4. Compare the intended ranges for overlap or unintended gaps.
  5. Verify that local-versus-gateway behavior matches the calculated boundary.

Interview scenario

Show answer and reasoning
Host A is 192.0.2.62/26 and Host B is 192.0.2.65/26. Explain why both addresses look close in decimal yet occupy different subnets, then state what Layer 3 path is required.

Knowledge check and summary

Knowledge check: What is the block size of a /26 in the fourth octet?
Knowledge check: What is the broadcast address for 192.0.2.128/26?
Knowledge check: Which statement about /31 is accurate?
Subnetting Fundamentals for IPv4