A subnet mask is not just math—it tells a host when a router is needed
Subnetting becomes much easier when every calculation answers a networking question. The prefix separates the network portion of an IPv4 address from the host portion. That boundary tells an endpoint whether a destination belongs to its own IP subnet or must normally be sent toward a default gateway.
Before moving to a mixed exam, test whether you can apply subnet boundaries inside a larger failure scenario. The AP Networking IP Addressing and Subnetting Practice Test includes 75 explained items that connect network identifiers, broadcast addresses, gateway placement, and nonoverlapping allocation.
Suppose a host is 192.168.50.70/27. The /27 creates blocks of 32 addresses in the final octet: 0–31, 32–63, 64–95, 96–127, and so on. The host belongs to 192.168.50.64/27. A destination at 192.168.50.90 is local. A destination at 192.168.50.100 is not. The addresses look similar in decimal, but the prefix—not visual similarity—controls the decision.
That decision changes the packet path. For a local IPv4 destination, the sender can resolve the destination's local Layer 2 address. For a remote destination, the sender normally resolves the Layer 2 address of its default gateway and sends the frame there while keeping the remote IP as the Layer 3 destination. This is why subnetting belongs in troubleshooting, routing, VLAN design, DHCP, and security—not only on calculation worksheets.
Boundary
Find the network block that contains the address.
Behavior
Use that boundary to decide whether the destination is local or remote.
Evidence
Use incorrect boundaries to explain gateway, ARP, DHCP, VLAN, or routing symptoms.
The prefixes worth recognizing instantly
You do not need to memorize subnetting as disconnected mask strings. Notice the halving pattern: every time the prefix grows by one bit, the address count per subnet is cut in half. That relationship gives you a built-in error check.
| Prefix | Mask | Block size | Total addresses | Traditional usable hosts | Final-octet boundaries when applicable |
|---|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 256 | 254 | .0 |
| /25 | 255.255.255.128 | 128 | 128 | 126 | .0, .128 |
| /26 | 255.255.255.192 | 64 | 64 | 62 | .0, .64, .128, .192 |
| /27 | 255.255.255.224 | 32 | 32 | 30 | .0, .32, .64, .96, .128, .160, .192, .224 |
| /28 | 255.255.255.240 | 16 | 16 | 14 | Every 16 |
| /29 | 255.255.255.248 | 8 | 8 | 6 | Every 8 |
| /30 | 255.255.255.252 | 4 | 4 | 2 | Every 4 |
Swipe horizontally to see the full table.
Use the same five steps for network, broadcast, host range, and locality
1. Convert the prefix to the relevant mask
For common last-octet problems, /25 = 128, /26 = 192, /27 = 224, /28 = 240, /29 = 248, and /30 = 252 in the final mask octet.
2. Find the block size
Subtract the interesting mask octet from 256. A /27 uses 224, so 256 − 224 = 32. Boundaries therefore occur every 32 addresses.
3. Find the boundary below the host
For 172.16.8.77/27, the boundaries are .0, .32, .64, .96… The last boundary not greater than .77 is .64. The network is 172.16.8.64/27.
4. Find broadcast and traditional host range
The next boundary is .96, so the broadcast is one less: .95. The traditional usable range is .65 through .94.
5. Turn the answer into behavior
Compare the destination to the same .64–.95 block. If it is inside, the host treats it as local. If it is outside, the host normally forwards toward its default gateway.
192.168.50.141/26: calculate it, then use it
Prefix: /26 → mask 255.255.255.192 → block size 64.
Boundaries: .0, .64, .128, .192.
Host: .141 lies in the .128–.191 block.
Network: 192.168.50.128/26.
Broadcast: 192.168.50.191.
Traditional usable range: .129–.190.
Now the calculation earns its keep. A destination at 192.168.50.180 is local to this host. A destination at 192.168.50.200 is remote. A proposed gateway at 192.168.50.129 is locally reachable; a proposed gateway at 192.168.50.193 is not in the host's /26.
This is a stronger mastery test than simply reporting “network .128.” You should be able to use the boundary to validate an endpoint configuration and predict how the host will try to forward traffic.
Block size is fast; binary explains why it works
IPv4 addresses contain 32 bits. A /26 says the first 26 bits are network bits and the remaining 6 are host bits. In the final octet, the /26 mask is 11000000, decimal 192. The host value 141 is 10001101. A bitwise AND preserves only the network bits:
10001101 141
11000000 192 mask
10000000 128 network value
The result is the same network boundary found with the block-size shortcut. Understanding both methods is useful: block size is efficient for common hand calculations, while binary explains prefixes that cross a different octet and helps prevent memorized tricks from becoming detached from the actual address logic.
24 interactive subnetting flashcards
These cards mix calculation with network behavior. Filter the deck when you need targeted review, then return to “All” so the topic label no longer gives away the method.
The subnet calculation changes who receives the Ethernet frame
For IPv4 communication on an Ethernet LAN, the endpoint first decides whether the destination IP is local according to its own configured prefix. If local, it can resolve the destination's MAC address and send directly at Layer 2. If remote, it normally resolves the default gateway's MAC address and sends the frame to the router. The remote IP remains the packet destination.
This distinction explains why a wrong mask can be so deceptive. A host with a mask that is too wide may believe a remote address is local. It can repeatedly try to resolve that destination on the local link rather than use the gateway. A mask that is too narrow can make a truly local peer appear remote, pushing traffic toward a gateway unnecessarily. Whether communication actually fails can depend on router behavior and topology, so the wrong mask does not guarantee one universal symptom.
That last point is important for troubleshooting: configuration errors produce behavior through mechanisms. Do not memorize “wrong mask = no Internet.” Instead, calculate how the incorrect prefix changes the local/remote classification for the specific destination in the scenario. Continue with Wrong Subnet Mask Symptoms for failure cases.
A default gateway normally must be reachable on the host's local subnet
Consider host 192.168.10.34/27. Its network is .32/27, broadcast is .63, and traditional usable range is .33–.62. A gateway at .62 is in the local subnet. A gateway at .65 belongs to the next /27. The host needs a local Layer 2 path to its next-hop router, so a gateway outside the host's configured subnet is a major configuration problem.
This gives you a useful exam habit: whenever an endpoint configuration artifact lists IP address, mask, and gateway, do not inspect those fields independently. Use the mask to validate the gateway. A syntactically valid IPv4 address can still be logically invalid for that host.
Then use evidence. If local same-subnet communication works but every remote destination fails, the gateway configuration or gateway reachability becomes more relevant. If the gateway responds and a remote numeric IP also works, the evidence has already moved beyond a basic gateway failure. See Default Gateway Explained and Wrong Default Gateway Symptoms.
A DHCP scope is an address plan, not merely a pool of numbers
A DHCP scope should supply clients with configuration appropriate for the intended subnet: usable addresses from the correct range, the correct prefix or mask, a reachable default gateway, and relevant options such as DNS servers. If the scope boundary is wrong, the server can hand out addresses that look valid but do not belong to the intended Layer 3 design.
For example, a /27 LAN at 10.50.4.64/27 has a traditional usable range of .65–.94. A pool that accidentally leases .100 is crossing into the next /27 block. A gateway option of .65 could be valid; .97 would not be in the same /27. Subnetting therefore gives you a way to audit DHCP artifacts instead of merely asking whether the client “got an IP.”
This also helps distinguish DHCP failure from later dependencies. If a client receives a valid address, correct /27 mask, local gateway, and appropriate DNS configuration, that is useful evidence about configuration delivery. It does not prove routing, DNS service health, or application reachability. Review the dependency in DHCP Explained.
Subnetting gives Layer 3 meaning to Layer 2 segmentation
A VLAN separates a switched network into a Layer 2 broadcast domain. In common designs, each VLAN receives a distinct IP subnet. Hosts in the same VLAN/subnet can communicate locally when policy and switching allow it; communication between different VLANs/subnets requires Layer 3 forwarding.
Imagine VLAN 10 uses 10.10.10.0/24 and VLAN 20 uses 10.10.20.0/24. The clean separation makes route tables, gateway interfaces, DHCP scopes, firewall rules, and troubleshooting easier to reason about. If both VLANs were configured with overlapping address space, devices and routers could disagree about which destinations are local or which interface should own a route.
Subnetting is therefore part of segmentation design. The prefix determines the Layer 3 population that shares an address boundary, while the VLAN determines the Layer 2 broadcast scope. Learn the companion concepts in VLAN Explained and Network Segmentation Explained.
The same prefix logic you use for hosts is used to describe route destinations
A route such as 10.20.30.0/24 represents a destination prefix. A router compares the destination IP with available routes and prefers the most specific matching prefix. If the same destination matches a /8, /16, /24, and /27, the /27 is the longest and therefore the most specific match.
Subnetting skill makes routing tables readable. Instead of seeing prefixes as labels, you can determine exactly which destination range each route covers. You can also detect overlap: a broader route can cover many networks while a narrower route carves out a more specific path. The default route 0.0.0.0/0 is the least specific IPv4 route and is used only when no more specific match wins.
Do not confuse route selection with path success. A router can select the mathematically correct prefix while the next hop is unreachable, an interface is down, a firewall blocks the flow, or the return route is missing. Practice that distinction with Routing Table Analysis Practice.
Six subnetting mistakes you can catch before they cost you the question
Using visual similarity
Two addresses can differ by one and sit on opposite sides of a subnet boundary. Always apply the prefix.
Calling the first host the network
The network address is the boundary itself. In 192.168.1.64/26, .64 is network and .65 is the first traditional host.
Forgetting the next boundary
Broadcast is one address before the next subnet boundary, not simply “network plus the number I remember.”
Subtracting two twice
Block size gives total addresses. Traditional usable hosts are total minus network and broadcast—once.
Validating IP but not gateway
A host address can be valid while its configured gateway sits outside the subnet.
Stopping after arithmetic
The stronger answer explains what the boundary changes about forwarding, DHCP, VLANs, routing, or the observed failure.
Three short cases that combine subnet math with network reasoning
Case 1: /28 boundary
Host: 10.1.4.46/28. Boundaries occur every 16, so .46 is in .32–.47. Network .32, broadcast .47, traditional hosts .33–.46. A gateway of .33 is valid.
Case 2: adjacent addresses
10.20.30.63/26 and 10.20.30.64/26 are not in the same subnet. .63 is the broadcast of .0/26; .64 is the next network address.
Case 3: route specificity
Destination 172.16.8.75 matches 172.16.0.0/16 and 172.16.8.64/27. The /27 is more specific and wins if both routes are otherwise eligible.
Once these feel automatic, use Subnetting Practice Questions and the Subnetting Calculator With Steps. The calculator is most useful as an answer checker after you have committed to your own boundary.
You know subnetting when you can predict the network behavior
A student who can convert /27 to 255.255.255.224 has useful recall. A student who can find the .64–.95 block has calculation skill. Stronger mastery is being able to look at a host, mask, destination, and gateway and explain what the endpoint will try to do next—and why an incorrect mask changes that behavior.
Before leaving this page, you should be able to calculate network and broadcast addresses, traditional host ranges, address capacity, and same-subnet status; validate a gateway and DHCP range; interpret route prefixes; explain why VLANs commonly use separate subnets; and diagnose how too-wide or too-narrow masks alter local-versus-remote decisions.