Skip to main content
LEARN / NETWORKING / FOUNDATIONS

Subnetting doesn't have to be a guessing game.

Understand what an IPv4 address actually means, how a subnet mask draws a boundary, and why routing works the way it does. We'll go from the basics to your first real subnet plan, one visual example at a time.

Stand-alone written lessonFundamentals → IntermediateVisual examples + mini quiz
Start the lesson 01 / Learn 02 / Practice
01 / IPV4 FUNDAMENTALS

Every IPv4 address has two jobs.

An IPv4 address is a 32-bit number that identifies a network interface within an IPv4 network. We usually write those bits as four decimal numbers (called octets), separated by dots. Each octet holds eight bits and ranges from 0 to 255.

OCTET 11928 bits
OCTET 21688 bits
OCTET 3108 bits
OCTET 4778 bits

An address alone isn't enough to determine which other IPs are on the same local network. The host also needs a prefix length or subnet mask. Those tell it which bits describe the network and which bits describe the specific interface.

Think: street name versus house number

The network portion tells you which street to find. The host portion identifies the house on that street. This analogy is imperfect, but it captures the division: different network portions require Layer 3 routing.

IP ADDRESS192.168.10.77

Where this interface is numbered.

SUBNET MASK255.255.255.192

Which address bits identify the network.

DEFAULT GATEWAY192.168.10.65

Example next hop for destinations outside the local subnet.

The addresses in our examples come from private IPv4 space. Common private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. They're commonly used inside home and business networks rather than routed as destinations across the public Internet.

02 / UNDERSTAND THE BITS

Binary is the reason subnet masks make sense.

Computers evaluate IPv4 addresses as bits—1s and 0s. The values of an octet's eight positions are 128 64 32 16 8 4 2 1. Add the positions containing a 1 to get the decimal value.

Example · Last octet = 7764 + 8 + 4 + 1 = 77
1280
641
320
160
81
41
20
11

Binary 01001101 equals decimal 77. The order matters: the largest place value is on the left.

A subnet mask is also 32 bits, written as contiguous 1s followed by 0s. The 1s identify network bits; the 0s identify host bits. That's what CIDR notation makes easy to count.

03 / CIDR & SUBNET MASKS

What does the slash actually mean?

In 192.168.10.77/26, the /26 means the first 26 bits identify the network. The remaining 6 bits are host bits. Because the mask contains 26 ones, it becomes 255.255.255.192.

NETWORK BITS26Fixed prefix
+
HOST BITS632 − 26
=
IPV4 BITS32Always for IPv4
The one rule to remember

A longer prefix means a smaller network. For example, a /27 holds half as many addresses as a /26. It's not the other way around.

Common subnet sizes

Conventional IPv4 subnet sizes, /24 through /30
PrefixDotted-decimal maskTotal addressesUsable hosts*
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

*The conventional usable-host count excludes the network and directed-broadcast addresses. A /31 is a special case permitted on supported point-to-point links, where both addresses may serve as endpoints; a /32 identifies one IPv4 address.

04 / NETWORKS, BROADCASTS & HOSTS

Find the network without memorizing magic numbers.

With 192.168.10.77/26, six host bits give 2⁶ = 64 total addresses. That means the last octet is divided into aligned 64-address blocks: 0–63, 64–127, 128–191, and 192–255.

WORKED EXAMPLE / 192.168.10.77/26Which block contains 77?
01 · Network address192.168.10.64

First address in the block.

02 · First usable192.168.10.65

One above the network.

03 · Last usable192.168.10.126

One below the broadcast.

04 · Broadcast address192.168.10.127

Last address in the block.

64 total addresses − 2 reserved = 62 usable host addresses in this conventional subnet.
INTERACTIVE / UNDERSTAND THE BOUNDARY

Watch the subnet move around one address.

Keep the host at 192.168.10.77. Change only its prefix length and see how the network and broadcast boundaries shift.

Sample · No configuration changes
192.168.10.0/24 address space4 networks · 64 addresses per block
0
64
128
192
.0.255

The /24 is split into 4 equal /26 networks, each containing 64 addresses. The highlighted block contains .77.

Network192.168.10.64/26
Broadcast192.168.10.127
Subnet mask255.255.255.192
Usable hosts62
32-bit IPv4 address Network bits Host bits
OCTET 1
11000000
OCTET 2
10101000
OCTET 3
00001010
OCTET 4
01001101

The prefix counts bits identifying the network. More network bits means fewer host bits, and smaller subnets.

Ready for arbitrary addresses? Open Practice 004's full CIDR decoder →

The same method works across octet boundaries too; the interactive example intentionally starts with /24–/28 so you can see the last-octet relationship. Practice 004 expands this to more general CIDR calculations.

05 / PRACTICAL ADDRESS PLANNING

VLSM: give each network the space it actually needs.

Variable-Length Subnet Masking (VLSM) lets you divide an allocated block into different-sized subnets. Suppose an organization receives 192.168.10.0/24 and needs networks for 50, 25, 12, and 2 devices. Equal-size divisions would waste space.

Start with the largest requirement, choose the smallest address block that provides enough usable hosts, and place each block on its correct binary boundary.

Example VLSM allocationParent network: 192.168.10.0/24 · 256 addresses
01 · Office devices192.168.10.0/2650 required · 62 usable · .0 – .63
02 · Guest devices192.168.10.64/2725 required · 30 usable · .64 – .95
03 · Lab equipment192.168.10.96/2812 required · 14 usable · .96 – .111
04 · Router link192.168.10.112/302 required · 2 usable · .112 – .115
116 addresses allocated140 remain unassigned in the parent /24
Don't confuse hosts with addresses.

The 50-device network needs a /26: 64 total addresses, 62 conventionally usable. The 2-device router link uses /30 in this example; on a suitable point-to-point link, /31 could be a separate, more address-efficient choice.

06 / WHERE THE PACKET GOES

A subnet boundary determines when routing is needed.

Consider a workstation at 192.168.10.77/26. Another device at 192.168.10.100 belongs to the same 192.168.10.64/26 network. The sender can normally use ARP to find the destination's MAC address and communicate on-link.

But 192.168.10.130 is in 192.168.10.128/26. The sender recognizes a different network and normally forwards traffic toward a default gateway. The router then decides where that packet goes next.

ON-LINK / SAME SUBNET
192.168.10.77→192.168.10.100

Local ARP + Layer 2 delivery, assuming they're on the same link.

OFF-SUBNET / VIA ROUTER
192.168.10.77→Gateway→192.168.10.130

Local frame goes to the gateway's MAC; IP destination remains the remote host.

Routers choose the most specific matching prefix.

A destination of 10.20.4.44 matches both 10.20.0.0/16 and 10.20.4.0/24. The router uses longest-prefix match, selecting the /24 because it matches more leading destination bits.

DESTINATION10.20.4.44
MATCHES10.20.0.0/16Broader route
BEST MATCH ✓10.20.4.0/24Longer prefix wins

A 0.0.0.0/0 route can act as a default when no more-specific route matches. If there's no usable route, the packet cannot simply reach an arbitrary network.

Useful read-only troubleshooting checks

On Windows, ipconfig /all shows address, mask and gateway settings; route print shows the route table. Compare them before changing anything. A failed ping alone does not prove a routing problem: ICMP can be filtered.

07 / QUICK KNOWLEDGE CHECK

Can you find the boundary?

Six focused questions, one at a time. Read the explanation before advancing. This is practice, not a graded exam.

0/6reviewed
QUESTION 1 OF 60% complete
QUESTION 01

What dotted-decimal subnet mask corresponds to a /26 IPv4 prefix?

Select an answer to continue.
OFFICIAL REFERENCES

Keep the fundamentals accurate.

For the formal IPv4 addressing and CIDR rules, these original engineering references are worth bookmarking.

NEXT REQUIRED STEP · NETWORKING FOUNDATIONS

Complete the Practice milestone

You've reached the end of this written lesson. Your next step is practice—complete IPv4 Subnetting & Routing · Module 004 before proceeding to a new lesson. This is milestone 2 of 9. You can revisit the explanation whenever you need it.