Subnetting determines which addresses belong to a network and how routing boundaries are formed. Cloud VPCs, office LANs, VPNs, and firewall rules all depend on correct subnet planning. Overlapping ranges can make routing and connectivity difficult when networks are connected.
Before You Begin
- An IPv4 address and prefix or subnet mask to examine.
- A list of existing network ranges if planning a new design.
- A calculator or command-line tool for verification.
Recommended Approach
1. Read the CIDR prefix
A prefix such as `/24` means the first 24 bits identify the network. The remaining bits are available for host addressing, subject to network and broadcast reservations in ordinary IPv4 subnets.
2. Calculate the address range
Use the prefix to determine the subnet mask, network address, broadcast address, and usable range. For example, a typical IPv4 `/24` contains 256 addresses, with 254 traditionally usable host addresses.
3. Check private address space
Common private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. These are not globally routed on the public internet and are commonly used for internal networks.
4. Plan non-overlapping ranges
Allocate address space for VPCs, sites, VPN clients, containers, and future expansion. Avoid using the same range in networks that may later be connected. Reserve space for growth and special-purpose subnets.
5. Verify routes and firewall scope
Confirm that route tables direct traffic to the correct next hop and that security rules use the intended CIDR. A correct subnet calculation does not by itself create connectivity.
Operational Considerations
Network changes should be made from a documented traffic requirement rather than from a guess about which port might be needed. Record the source, destination, protocol, port, route, and security zone for each required flow. Keep a known-good configuration backup and a recovery path outside the network segment being changed. When possible, stage policy changes and test them during a maintenance window with someone available to verify application behavior.
How to Verify the Result
Troubleshoot one layer at a time: link and interface state, IP address and subnet, default route, DNS resolution, path reachability, firewall decision, and application listener. Capture the exact source and destination addresses and ports. A failed ping or one traceroute timeout is not conclusive; test the actual application protocol and review firewall or device logs to identify where the connection is being dropped.
Example Configuration
Illustrative example — adapt values to your environment
# Python: inspect an IPv4 network
import ipaddress
net = ipaddress.ip_network("192.168.10.0/24")
print(net.network_address, net.broadcast_address)
print(net.num_addresses, net.netmask)
Common Mistakes to Avoid
- Do not assume every subnet has 254 usable hosts; usable counts depend on prefix and platform reservations.
- Do not use public address space internally unless you control the allocation and routing.
- Overlapping VPN and cloud CIDRs can cause difficult asymmetric routing problems.
Make one change at a time, test it from the perspective of the actual user or application, and record the reason for the change. Keep a rollback path for network, identity, and production configuration changes.
Final Checklist
- The configuration matches the intended environment and service version.
- Access is limited to the required identities, resources, ports, and operations.
- The expected workflow has been tested, including a negative test for unauthorized access.
- Secrets and temporary credentials are protected and excluded from logs and source control.
- The configuration owner, purpose, and review or expiration date are documented.