Home and office routers hand out addresses from the private IPv4 ranges defined in RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. When a device joins your network, DHCP gives it an IP address, a subnet mask and a default gateway. Knowing how the mask works helps you avoid IP conflicts and routing problems.
How a standard /24 works
Most home routers default to /24 (mask 255.255.255.0), for example 192.168.1.0/24:
-
Network address:
192.168.1.0(identifies the network itself) -
Default gateway:
192.168.1.1(usually the router's LAN interface, though some vendors use a different address) -
Usable hosts:
192.168.1.2to192.168.1.254(253 addresses for clients, 254 if you count the gateway) -
Broadcast address:
192.168.1.255
Common prefix lengths
| CIDR | Subnet mask | Usable hosts | Typical use |
|---|---|---|---|
| /24 | 255.255.255.0 | 254 | Home or small office LAN |
| /25 | 255.255.255.128 | 126 | Split a LAN in two |
| /26 | 255.255.255.192 | 62 | Departments or guest Wi-Fi |
| /27 | 255.255.255.224 | 30 | Small VLANs |
| /28 | 255.255.255.240 | 14 | IoT segment |
| /29 | 255.255.255.248 | 6 | DMZ or small server group |
| /30 | 255.255.255.252 | 2 | Point-to-point links |
The formula is 2^(32 - prefix) - 2 usable hosts (minus the network and broadcast addresses).
Calculate it in Python
import ipaddress
net = ipaddress.ip_network("192.168.1.0/28")
hosts = list(net.hosts())
print("Network: ", net.network_address) # 192.168.1.0
print("Broadcast:", net.broadcast_address) # 192.168.1.15
print("Range: ", hosts[0], "-", hosts[-1]) # 192.168.1.1 - 192.168.1.14
print("Usable: ", len(hosts)) # 14
print("Wildcard: ", net.hostmask) # 0.0.0.15
If you'd rather not do the binary by hand, I built a free CIDR subnet calculator that shows the network ID, usable range and wildcard mask for any prefix.
Find your active default gateway
Not every network uses 192.168.1.1. Xfinity hardware often uses 10.0.0.1, and many mobile hotspots use 192.168.8.1. Check yours from the terminal:
-
Windows:
ipconfigand look at the Default Gateway line -
Linux:
ip route | grep default -
macOS:
route -n get default(ornetstat -nr | grep default)
If you need the default login address for a specific router brand, the Router IP Guide gateway index lists them.
Key takeaways
- A larger prefix number means a smaller subnet.
- Always subtract 2 for the network and broadcast addresses.
- Use
/28or smaller to isolate IoT devices and keep VLANs tidy.
Questions or a prefix you want covered? Drop it in the comments.
Top comments (0)