Subnet planning prevents overlapping address ranges and helps allocate IP space efficiently. This guide covers masks, CIDR prefixes, and a practical network-to-broadcast calculation.
IPv4 subnetting is the process of dividing a 32-bit IPv4 address space into smaller networks using a subnet mask, which identifies network bits and host bits. Subnet mask calculation converts a CIDR prefix into the corresponding binary or dotted-decimal mask. These values determine each subnet’s total addresses, network address, broadcast address, and conventional usable host range.
An IPv4 address contains four eight-bit octets, such as 192.168.1.1. A subnet mask identifies which bits belong to the network and which identify hosts. For example, 255.255.255.0, or /24, leaves eight host bits, so the subnet has 256 total addresses.
Administrators subnet networks to separate workloads, control broadcast domains, and allocate addresses without conflicts. Hosting providers and ISPs choose prefixes by capacity needs. Real host availability can be lower when gateways or platforms reserve addresses.
To calculate a subnet mask, read the CIDR prefix as the count of leading one-bits. For /29, the binary mask is 11111111.11111111.11111111.11111000, or 255.255.255.248 in decimal.
The basic IPv4 subnetting formula is:
To calculate usable IPv4 hosts in a /29, subtract two from eight: six remain. The conventional formula excludes network and broadcast addresses; /31 and /32 are exceptions.
Consider 10.20.4.13/29. To calculate an IPv4 subnet, follow six steps:
In this IPv4 subnetting calculation example, the broadcast address is calculated by adding the block size minus one to the network address. A bitwise AND between the IP and its mask also yields the network address. Together, these endpoints define the complete IPv4 network range.
An IPv4 subnet mask sets the address capacity:
A /31 contains two addresses that can both serve as endpoints on a supported point-to-point link under RFC 3021. A /32 identifies a single IPv4 address, often used as a host route. These cases differ from the standard network-and-broadcast reservation model.
Variable Length Subnet Masking (VLSM) uses different prefix lengths within a larger network. A /26 can serve servers, a /27 a department, and a /28 a smaller office. Leave room for infrastructure and growth. A reliable IPv4 subnetting method allocates the largest block first, aligns each subnet to a valid boundary, and records every range. This limits wasted addresses and overlap.
Avoid these errors during subnet mask calculation:
Check results with an IP address management tool. Cloud reservations differ, while public IPv4 blocks also need correct registration and routing authorization. A valid /26 subnet is not necessarily a globally accepted BGP announcement.
Hosting, VPN, proxy, and cloud teams use IPv4 mask calculation to size public IP blocks. Address reputation, geolocation, routing support, and growth also matter. Teams can rent IPv4 addresses for flexible needs, buy IPv4 address space for long-term plans, or use Bring Your Own IP in supported clouds. Check minimum prefixes and routing conditions; some deployments require a publicly routable /24 rather than smaller internal subnets.
How do you calculate the network address?
Apply the subnet mask to the IPv4 address with a bitwise AND operation. The result is the network’s starting address.
How do you calculate the broadcast address?
For a conventional IPv4 subnet, add the total address count minus one to the network address. That produces the last address in the range.
How many usable IPv4 hosts are in a /29?
Normally six. A /29 contains eight addresses, with one network address and one broadcast address.
Does every subnet reserve two unusable addresses?
No. RFC 3021 permits both addresses of a /31 on supported point-to-point links, while /32 identifies one address. Cloud-specific reservations may also differ.
Plan IPv4 capacity using accurate subnet boundaries, allocation records, and routing checks. For additional public address space, contact InterLIR to discuss IPv4 leasing, purchasing, or cloud deployment options and identify a prefix that fits your host requirements, network policies, and expected growth. Before deployment, confirm the necessary registry records, block reputation, and upstream routing support.
Evgeny Sevastyanov
Client Support Teamleader
Live chat is provided by Intercom and is loaded only after you enable it. You can also contact us without enabling the chat.