Subnetting · Lesson 3 of 7
Subnet Math
0 / 5 checkpoints answered
Subnet math applies a prefix length to the 32 bits of an IPv4 address. Binary reasoning prevents mistakes at prefix boundaries that do not align with decimal octets.
Finding the Network Address
Use address 192.168.1.165/24:
address 11000000.10101000.00000001.10100101
mask 11111111.11111111.11111111.00000000
network 11000000.10101000.00000001.00000000
A bitwise AND keeps address bits where the mask is one and clears host bits. The result is 192.168.1.0/24.
CheckWhich operation finds an IPv4 network address from an address and mask?
press 1/2/3 to answer · → next lesson
Counting Addresses
For prefix /p, the host portion contains 32 - p bits. The total address count is:
2^(32 - p)
A /24 therefore contains 2^8 = 256 addresses. In a traditional broadcast subnet, the all-zero host value is the network address and the all-one value is the directed broadcast, leaving 254 ordinary unicast host addresses.
CheckHow many total addresses are in an IPv4 /24?
press 1/2/3 to answer · → next lesson
Finding a Block Boundary
For /26, the mask is 255.255.255.192. The final-octet block size is 256 - 192 = 64, so subnet boundaries are 0, 64, 128, and 192. Address 192.168.1.165/26 lies in:
network: 192.168.1.128
broadcast: 192.168.1.191
range: 192.168.1.129 through 192.168.1.190
CheckWhat is the network address for 192.168.1.165/26?
press 1/2/3 to answer · → next lesson
Accounting for Prefix Exceptions
The shortcut 2^host_bits - 2 is not universal. IPv4 /31 prefixes are defined for point-to-point links where both addresses can be endpoints and no directed broadcast is needed. A /32 identifies one host route or interface address. Network technology and protocol use determine which addresses are assignable.
CheckWhy should you not subtract two addresses from every IPv4 prefix?
press 1/2/3 to answer · → next lesson
Verifying Calculations
Use an independent tool or library to check manual work, then compare with the real interface and route configuration. A mathematically valid prefix can still conflict with another subnet or violate an allocation plan.
CheckWhat does a correct subnet calculation fail to prove?
press 1/2/3 to answer · → next lesson
Summary
You can now calculate IPv4 subnet boundaries and recognize common exceptions.
- Find a network address with bitwise AND.
- Count total addresses from the number of host bits.
- Use block sizes to locate network and broadcast boundaries.
- Handle
/31and/32according to their intended use. - Verify mathematical results against the actual address plan.
Lesson complete
You finished Subnet Math. Nice work — keep the momentum going.