Introduction
An IPv4 address is a 32-bit number, usually written as four decimal octets separated by dots (dotted-decimal notation), such as 192.168.1.5. Every IP address is split into a network portion and a host portion; subnetting is the technique of borrowing bits from the host portion to create smaller, more efficient sub-networks, described using CIDR (Classless Inter-Domain Routing) notation like /26.
Cricket analogy: A cricket ground's seating chart, like 192.168.1.5, splits into a stand section, the network, and a specific seat number, the host; subnetting is like dividing the Eden Gardens stand into smaller ticket-tier blocks, marked like a /26 zone.
Explanation
The CIDR prefix length (the number after the slash) tells you how many of the 32 bits are the network portion; the remaining bits are the host portion. The subnet mask is the binary representation of that split, written in dotted-decimal form: for example, a /26 mask is 11111111.11111111.11111111.11000000 in binary, which converts to 255.255.255.192. The number of addresses in a subnet is 2 raised to the number of host bits. For a /26, there are 32 - 26 = 6 host bits, so 2^6 = 64 total addresses in that subnet. Of those 64, the first address is reserved as the network address (identifies the subnet itself) and the last is reserved as the broadcast address (used to reach every host on that subnet), leaving 64 - 2 = 62 usable host addresses.
Cricket analogy: A T20 squad list capped at a fixed roster size, like the 2^6=64 slots in a /26, always reserves two names off the playing eleven, the substitute and reserve slots, leaving exactly 62 usable spots, matching 62 usable hosts.
Example
# Fully worked CIDR example: 192.168.1.0/26
#
# Step 1: Prefix length /26 means 26 network bits, 32-26 = 6 host bits.
# Step 2: Subnet mask in binary (last octet): 11000000
# Full mask: 11111111.11111111.11111111.11000000
# Decimal: 255 .255 .255 .192
#
# Step 3: Addresses per subnet = 2^6 = 64
# Step 4: Usable hosts = 64 - 2 = 62 (subtract network + broadcast)
#
# Step 5: Network address = 192.168.1.0 (host bits all 0: 00000000)
# Broadcast address = 192.168.1.63 (host bits all 1: 00111111)
# Usable host range = 192.168.1.1 - 192.168.1.62
network = "192.168.1.0"
mask = "255.255.255.192"
prefix = 26
total_addresses = 2 ** (32 - prefix) # 64
usable_hosts = total_addresses - 2 # 62
broadcast_last_octet = 0 + total_addresses - 1 # 63 -> 192.168.1.63
print(network, mask, total_addresses, usable_hosts, broadcast_last_octet)
# 192.168.1.0 255.255.255.192 64 62 63Analysis
Breaking down the last octet in binary makes the math verifiable by hand: the /26 mask leaves the last two bits (positions worth 2 and 1) as host bits, meaning subnet boundaries fall every 64 addresses (0, 64, 128, 192). For the 192.168.1.0/26 subnet, the last octet ranges from 00000000 (0, the network address) to 00111111 (63, the broadcast address), confirming 64 total addresses, a valid host range of 192.168.1.1 through 192.168.1.62, and 62 usable hosts. This same /26 block also means 192.168.1.0/24 (256 addresses) can be split into exactly four /26 subnets: .0/26, .64/26, .128/26, and .192/26, each holding 62 usable hosts. Always double-check subnetting arithmetic using the formula 2^(host bits) for total size and subtracting 2 for usable hosts.
Cricket analogy: An IPL season's 256 possible match slots naturally split into four 64-match quarters, 0-63, 64-127, 128-191, 192-255, the same way a /24 splits into four /26 subnets at boundaries 0, 64, 128, and 192.
Key Takeaways
- A /26 network has a mask of 255.255.255.192, giving 2^6 = 64 total addresses per subnet.
- Usable host addresses = total addresses - 2 (network address + broadcast address), so /26 gives 62 usable hosts.
- For 192.168.1.0/26: network address is 192.168.1.0, broadcast is 192.168.1.63, usable range is 192.168.1.1-192.168.1.62.
- Larger prefix length (more network bits) means smaller subnets with fewer hosts, and vice versa.
Practice what you learned
1. What is the subnet mask for a /26 network?
2. How many usable host addresses does a /26 subnet provide?
3. For the subnet 192.168.1.0/26, what is the broadcast address?
4. What does the network prefix length in CIDR notation (e.g., the 26 in /26) indicate?
Was this page helpful?
You May Also Like
IPv4 vs IPv6
Compare the two IP versions across address size, notation, and how IPv6 changes the need for NAT.
Network Layer Basics
Learn how the network layer handles logical addressing, packet forwarding, and fragmentation to move data across networks.
Routing Fundamentals
Understand how routers use routing tables and longest prefix match to forward packets, and the difference between static and dynamic routing.
Network Address Translation (NAT)
See how NAT rewrites private IP addresses to public ones, conserving IPv4 addresses and hiding internal network structure.