IPv4 and IPv6 Subnetting: CIDR Notation Explained
Master CIDR notation, subnet masks, and the key differences between IPv4 and IPv6 subnetting with practical examples.
IPv4 and IPv6 Subnetting: CIDR Notation Explained
Subnetting is the practice of dividing a network into smaller sub-networks. It's one of the most essential skills in networking — and one of the most frequently fumbled under pressure. This guide cuts through the confusion with clear examples for both IPv4 and IPv6.
What Is CIDR Notation?
CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its network prefix length in a single string:
192.168.1.0/24
The number after the slash is the prefix length — it tells you how many bits of the address are fixed (the network portion). The remaining bits identify individual hosts.
For /24:
- Network bits: 24
- Host bits: 32 − 24 = 8
- Usable hosts: 2⁸ − 2 = 254 (subtract network and broadcast addresses)
Subnet Masks
Before CIDR, subnet masks were written in dotted-decimal notation. They're equivalent:
| CIDR | Subnet Mask | Hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /30 | 255.255.255.252 | 2 |
CIDR notation is preferred in modern documentation — it's more compact and unambiguous.
Calculating Subnets
Network Address
Apply the subnet mask to the IP address using a bitwise AND:
IP: 192.168.1.130 → 11000000.10101000.00000001.10000010
Mask: 255.255.255.128 → 11111111.11111111.11111111.10000000
AND: ----------------------------------------
Net: 192.168.1.128 → 11000000.10101000.00000001.10000000
Broadcast Address
Set all host bits to 1:
192.168.1.128/25 → broadcast: 192.168.1.255
Usable Range
192.168.1.128/25 → 192.168.1.129 to 192.168.1.254
Subnetting a Block
Say you have 10.1.0.0/24 and need four equal subnets. Borrowing 2 bits from the host portion gives you four /26 subnets:
10.1.0.0/26 → 10.1.0.0 – 10.1.0.63
10.1.0.64/26 → 10.1.0.64 – 10.1.0.127
10.1.0.128/26 → 10.1.0.128 – 10.1.0.191
10.1.0.192/26 → 10.1.0.192 – 10.1.0.255
IPv4 vs IPv6 Subnetting
IPv6 Address Structure
IPv6 addresses are 128 bits, written as eight groups of four hexadecimal digits:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Consecutive all-zero groups can be compressed with :: — but only once per address:
2001:db8:85a3::8a2e:370:7334
IPv6 Prefix Allocation Conventions
| Prefix | Usage |
|---|---|
| /32 | Allocated to ISPs by RIRs |
| /48 | Allocated to an organization or site |
| /56 | Allocated to a customer premise |
| /64 | Standard subnet size for a single LAN |
| /128 | Single host (loopback, anycast) |
The /64 boundary is significant: IPv6 SLAAC (Stateless Address Autoconfiguration) requires a /64 subnet. You should always allocate /64s to end-user subnets even though it "wastes" address space — with IPv6, there is no shortage.
Key Differences from IPv4
- No broadcast: IPv6 uses multicast instead.
- No NAT required: Every device can have a globally routable address.
- Link-local addresses: Every IPv6 interface auto-generates a
fe80::/10address for local communication. - Larger headers: IPv6 headers are fixed-size but larger (40 bytes vs. 20 bytes minimum for IPv4).
Quick Reference: Powers of 2
/24 = 256 addresses (254 usable)
/23 = 512 addresses (510 usable)
/22 = 1,024 addresses
/21 = 2,048 addresses
/20 = 4,096 addresses
/16 = 65,536 addresses
Calculate Subnets Instantly
Stop doing subnet math by hand. The IP Calculator on InfraHub computes network address, broadcast, usable range, wildcard mask, and host count for any IPv4 or IPv6 CIDR block. It also shows the binary breakdown so you can verify your understanding.
Paste in any subnet and get the full breakdown in under a second — useful for quick validation during network design reviews or certification exam prep.