2 Network Ranges and Usable Hosts
Learn how IPv4 CIDR prefixes divide network and host bits, how to calculate subnet ranges and host capacity, and when the usual usable-host rule has exceptions.
How prefixes divide IPv4 addresses
An IPv4 address contains bits. In , an address is followed by a , as in 192.168.10.77/26. The identifies the leading network bits; the remaining bits are and identify addresses within that network. This is equivalent to a subnet mask with leading bits.
Calculating network and broadcast addresses
For a , set all to to find the , and set all to to find the . The total number of addresses in the block is
For conventional subnets from /0 through /30, the is the total address count minus two, because the network and broadcast addresses are reserved.
Finding a subnet with the
To work in decimal, find the octet where the mask stops being 255 or becomes less than 255. The in that octet is . The network starts at the multiple of that size that contains the given address, and the is the end of that block.
Example: 192.168.10.77/26
A /26 mask is 255.255.255.192. The last-octet is , so the subnet blocks begin at 0, 64, 128, and 192. Since the last octet 77 falls in the block from 64 through 127, the results are:
Network:
192.168.10.64Broadcast:
192.168.10.127Usable host range:
192.168.10.65–192.168.10.126Total addresses:
Usable hosts:
The input address 192.168.10.77 is a usable host address in this subnet, not the network or .
and host capacity
The number of is . For ordinary subnets, the determines the host capacity:
/24has , total addresses, and usable hosts./26has , total addresses, and usable hosts./30has , total addresses, and usable hosts.
A larger leaves fewer and creates a smaller address block. For example, /26 contains fewer addresses than /24.
Special cases for /31 and /32
The usual rule of subtracting two addresses has exceptions.
A
/31contains two addresses and is used on point-to-point links. Both addresses can be assigned to the link endpoints; neither is treated as the conventional network or directed-.A
/32contains one address and represents a single-address prefix, often used as a .
Checking a subnet calculation
Use these checks to verify a subnet calculation:
Confirm that the prefix is between
/0and/32.Check that the has all set to and the has all set to .
Verify that the given IP address falls between the calculated network and broadcast addresses.
For ordinary subnets, confirm that the usable range excludes those two endpoints. Apply the
/31and/32exceptions where relevant.