IPv4 Subnetting in 20 minutes
Subnetting is the act of dividing a single IPv4 network into smaller, non-overlapping subnetworks by extending the network mask. This lesson explains how prefix length controls subnet size, why /30 is standard for point-to-point links, and the math every networking learner must memorize.
Open this labWhat a subnet actually is
An IPv4 address is 32 bits long, conventionally written as four decimal octets such as 192.168.10.42. The address is split into two parts: a network portion that identifies which subnet the host lives in, and a host portion that identifies the host within that subnet. The boundary between the two is set by the subnet mask.
When the mask is written in CIDR notation — for example /24 — the number after the slash counts the network bits from the left. /24 means the first 24 bits are network and the last 8 bits are host. That leaves 2^8 − 2 = 254 usable host addresses (the network and broadcast addresses are reserved).
The masks you must memorize
Every networking learner internalizes a small table of common prefixes and their dotted-decimal masks. Here are the ones that show up constantly:
/24 255.255.255.0 254 hosts typical user LAN
/25 255.255.255.128 126 hosts half a /24
/26 255.255.255.192 62 hosts small office
/27 255.255.255.224 30 hosts small VLAN
/28 255.255.255.240 14 hosts IoT segment
/29 255.255.255.248 6 hosts tiny lab
/30 255.255.255.252 2 hosts point-to-point WAN
/31 255.255.255.254 2 hosts RFC 3021 PtP
/32 255.255.255.255 1 host loopback / host routeWhy /30 for serial links
A point-to-point WAN link has exactly two endpoints. A /30 gives you four addresses: one network, one broadcast, and two usable hosts. That is a perfect fit and wastes no IP space. Many large WAN designs sit on /30s by default; modern code paths increasingly use /31s (RFC 3021) which save one more address by repurposing the network and broadcast bits as hosts.
Calculating the network address
To find the network a given IP belongs to, perform a bitwise AND between the IP and the mask. For 192.168.10.42 with mask 255.255.255.224 (/27), the network is 192.168.10.32 and the broadcast is 192.168.10.63. Hosts .33 through .62 are usable.
NetForge-AI does this math for you under the hood — but doing it by hand once or twice cements the intuition.
Try it in the lab
Drop two PCs and one switch onto the canvas. Configure 192.168.1.10/24 on PC1 and 192.168.1.20/24 on PC2. Ping. It works. Now change PC2 to 192.168.2.20/24 and ping again — it fails because the destination is no longer in the same subnet, and there is no router to forward the packet. That single change is the entire reason routers exist.
Practice this in the lab
Reading helps. Wiring it up yourself and breaking it makes it stick.
Open the lab