JUMP TO SECTIONChoose a lesson section
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.
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.
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.
Where this interface is numbered.
Which address bits identify the network.
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.
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.
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.
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.
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
| Prefix | Dotted-decimal mask | Total addresses | Usable hosts* |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
*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.
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.
First address in the block.
One above the network.
One below the broadcast.
Last address in the block.
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.
The /24 is split into 4 equal /26 networks, each containing 64 addresses. The highlighted block contains .77.
The prefix counts bits identifying the network. More network bits means fewer host bits, and smaller subnets.
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.
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.
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.
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.
Local ARP + Layer 2 delivery, assuming they're on the same link.
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.
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.
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.
Can you find the boundary?
Six focused questions, one at a time. Read the explanation before advancing. This is practice, not a graded exam.
What dotted-decimal subnet mask corresponds to a /26 IPv4 prefix?
Keep the fundamentals accurate.
For the formal IPv4 addressing and CIDR rules, these original engineering references are worth bookmarking.
