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.

Free account

Continue this lesson for free

Unlock the remaining explanation, Wireshark checks, quizzes, interview answers, and saved progress. No payment required.

Continue with Google or email
Subnetting Fundamentals for IPv4