Subnetting – FLSM, VLSM, CIDR, Binary Method & Route Summarisation
1. What Is Subnetting and Why Does It Matter?
Subnetting is the process of dividing a single IP network into smaller logical subnetworks (subnets). Without subnetting, every device in the same network address space would be in the same broadcast domain — a single broadcast from one device reaches every other device, wasting bandwidth and creating security exposure.
| Benefit | How Subnetting Provides It |
|---|---|
| Reduced broadcast traffic | Each subnet is its own broadcast domain. Broadcasts stay within the subnet and do not cross routers to other subnets |
| Efficient IP address use | VLSM lets you allocate only as many addresses as a segment needs instead of wasting a full /24 on a 2-host WAN link |
| Security isolation | Routers between subnets can apply ACLs, VLANs, and firewall policies to control inter-subnet traffic |
| Simpler troubleshooting | Smaller, isolated subnets contain problems; a broadcast storm in one subnet does not affect others |
| Route summarisation | Contiguous subnets can be summarised into a single route entry, reducing routing table size across the network |
Related pages: Private vs Public IP Addresses | Default Routes | Static Routing Configuration | DHCP How It Works | OSPF Overview | OSPF Single-Area Lab (uses subnetting) | DHCP Server Configuration Lab
2. IPv4 Address Structure — Binary Breakdown
An IPv4 address is 32 bits long, written as four 8-bit octets in dotted decimal. The subnet mask defines where the network portion ends and the host portion begins.
IPv4 address: 192.168.10.100 /26 Binary representation: 192 . 168 . 10 . 100 11000000 . 10101000 . 00001010 . 01100100 Subnet mask /26 = 26 consecutive 1-bits followed by 6 zero-bits: 11111111 . 11111111 . 11111111 . 11000000 255 . 255 . 255 . 192 AND the IP address with the subnet mask to find the Network Address: 11000000 . 10101000 . 00001010 . 01100100 (192.168.10.100) 11111111 . 11111111 . 11111111 . 11000000 (255.255.255.192) ------------------------------------------------ AND operation 11000000 . 10101000 . 00001010 . 01000000 (192.168.10.64) <-- Network address Host bits (6 bits of zeros = network, all 1s = broadcast): Network address: ...01000000 = 192.168.10.64 First usable host: ...01000001 = 192.168.10.65 Last usable host: ...01111110 = 192.168.10.126 Broadcast address: ...01111111 = 192.168.10.127
Octet Bit Values — Reference
Bit position: 128 64 32 16 8 4 2 1
Binary: 1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255
These are the only valid values for the last octet of a subnet mask.
Any other value (e.g., 253, 127, 37) is INVALID.
3. IP Address Classes and Default Masks
| Class | First Octet Range | Full Range | Default Mask | CIDR | Network / Host Bits |
|---|---|---|---|---|---|
| A | 1 – 126 | 1.0.0.0 – 126.255.255.255 | 255.0.0.0 | /8 | 8 network / 24 host = 16,777,214 hosts |
| B | 128 – 191 | 128.0.0.0 – 191.255.255.255 | 255.255.0.0 | /16 | 16 network / 16 host = 65,534 hosts |
| C | 192 – 223 | 192.0.0.0 – 223.255.255.255 | 255.255.255.0 | /24 | 24 network / 8 host = 254 hosts |
| D | 224 – 239 | 224.0.0.0 – 239.255.255.255 | N/A (Multicast) | N/A | Reserved for multicast groups (OSPF, PIM, etc.) |
| E | 240 – 255 | 240.0.0.0 – 255.255.255.255 | N/A (Experimental) | N/A | Reserved — not used in production networks |
4. The Core Subnetting Formulas
n = number of borrowed subnet bits (bits stolen from host portion) h = number of remaining host bits Number of subnets created: 2^n Total addresses per subnet: 2^h Usable host addresses: 2^h - 2 (subtract network + broadcast) Block size (increment): 256 - last_octet_of_subnet_mask Example: /26 subnet mask = 255.255.255.192 Last octet = 192 Host bits = 32 - 26 = 6 Total addresses = 2^6 = 64 Usable hosts = 64 - 2 = 62 Block size = 256 - 192 = 64 To find required prefix from host count: Need 50 hosts? -> 2^h - 2 >= 50 -> 2^6 = 64 -> 64 - 2 = 62 >= 50 -> /26 Need 12 hosts? -> 2^h - 2 >= 12 -> 2^4 = 16 -> 16 - 2 = 14 >= 12 -> /28 Need 2 hosts? -> 2^h - 2 >= 2 -> 2^2 = 4 -> 4 - 2 = 2 >= 2 -> /30 Special cases: /31: 2 addresses, 0 usable (RFC 3021 allows point-to-point use with 2 hosts) /32: 1 address, 0 usable (host route -- loopback, interface-specific routes)
5. The Complete Subnet Reference Table (/24 to /30)
Memorising this table is essential for CCNA exam speed — many questions require converting between prefix length, subnet mask, host count, and block size in seconds.
| CIDR | Subnet Mask | Host Bits | Total Addresses | Usable Hosts | Block Size | Subnets from /24 |
|---|---|---|---|---|---|---|
| /24 | 255.255.255.0 | 8 | 256 | 254 | 256 | 1 |
| /25 | 255.255.255.128 | 7 | 128 | 126 | 128 | 2 |
| /26 | 255.255.255.192 | 6 | 64 | 62 | 64 | 4 |
| /27 | 255.255.255.224 | 5 | 32 | 30 | 32 | 8 |
| /28 | 255.255.255.240 | 4 | 16 | 14 | 16 | 16 |
| /29 | 255.255.255.248 | 3 | 8 | 6 | 8 | 32 |
| /30 | 255.255.255.252 | 2 | 4 | 2 | 4 | 64 |
| /31 | 255.255.255.254 | 1 | 2 | 0 (2 with RFC 3021) | 2 | 128 |
| /32 | 255.255.255.255 | 0 | 1 | 0 (host route) | 1 | 256 |
6. Fixed-Length Subnet Masking (FLSM)
FLSM uses the same subnet mask for every subnet in the design. All subnets are equal in size. This is simpler to calculate but wastes IP addresses when subnets have very different host requirements.
FLSM Step-by-Step Method
Problem: Subnet 192.168.10.0/24 into exactly 4 equal subnets. Step 1 — Determine how many subnet bits to borrow: Need 4 subnets. 2^n >= 4 -> n = 2 (2^2 = 4) Borrow 2 bits from host portion. Step 2 — Calculate new prefix: Original /24 + 2 borrowed bits = /26 Step 3 — Calculate block size: New subnet mask = 255.255.255.192 Block size = 256 - 192 = 64 Step 4 — List all subnets (increment by block size): Start at 192.168.10.0, add 64 each time:
| Subnet | Network Address | First Usable Host | Last Usable Host | Broadcast | Usable Hosts |
|---|---|---|---|---|---|
| 1 | 192.168.10.0/26 | 192.168.10.1 | 192.168.10.62 | 192.168.10.63 | 62 |
| 2 | 192.168.10.64/26 | 192.168.10.65 | 192.168.10.126 | 192.168.10.127 | 62 |
| 3 | 192.168.10.128/26 | 192.168.10.129 | 192.168.10.190 | 192.168.10.191 | 62 |
| 4 | 192.168.10.192/26 | 192.168.10.193 | 192.168.10.254 | 192.168.10.255 | 62 |
7. Variable-Length Subnet Masking (VLSM)
VLSM allows different subnet masks within the same network, fitting the subnet size to the actual number of hosts needed. It requires classless routing protocols (OSPF, EIGRP, RIPv2, BGP) that carry subnet mask information in their updates.
VLSM Golden Rule
VLSM Worked Example — Full Solution
Problem: Given 192.168.20.0/24, create subnets for: Subnet A: 100 hosts Subnet B: 50 hosts Subnet C: 10 hosts Subnet D: 2 hosts (WAN link between two routers) Allocate largest first: SUBNET A (100 hosts): 2^h - 2 >= 100 -> h = 7 (2^7 - 2 = 126) -> /25 Network: 192.168.20.0/25 Range: 192.168.20.1 - 192.168.20.126 Broadcast: 192.168.20.127 (Used: .0 - .127 = 128 addresses) SUBNET B (50 hosts): 2^h - 2 >= 50 -> h = 6 (2^6 - 2 = 62) -> /26 Next available: 192.168.20.128 Network: 192.168.20.128/26 Range: 192.168.20.129 - 192.168.20.190 Broadcast: 192.168.20.191 (Used: .128 - .191 = 64 addresses) SUBNET C (10 hosts): 2^h - 2 >= 10 -> h = 4 (2^4 - 2 = 14) -> /28 Next available: 192.168.20.192 Network: 192.168.20.192/28 Range: 192.168.20.193 - 192.168.20.206 Broadcast: 192.168.20.207 (Used: .192 - .207 = 16 addresses) SUBNET D (2 hosts -- WAN point-to-point): 2^h - 2 >= 2 -> h = 2 (2^2 - 2 = 2) -> /30 Next available: 192.168.20.208 Network: 192.168.20.208/30 Range: 192.168.20.209 - 192.168.20.210 Broadcast: 192.168.20.211 (Used: .208 - .211 = 4 addresses) Remaining unused: 192.168.20.212 - 192.168.20.255 (44 addresses for future use)
| Subnet | Hosts Needed | CIDR | Subnet Mask | Network Address | Usable Range | Broadcast | Usable Hosts |
|---|---|---|---|---|---|---|---|
| A | 100 | /25 | 255.255.255.128 | 192.168.20.0 | .1 – .126 | .127 | 126 |
| B | 50 | /26 | 255.255.255.192 | 192.168.20.128 | .129 – .190 | .191 | 62 |
| C | 10 | /28 | 255.255.255.240 | 192.168.20.192 | .193 – .206 | .207 | 14 |
| D (WAN) | 2 | /30 | 255.255.255.252 | 192.168.20.208 | .209 – .210 | .211 | 2 |
8. FLSM vs VLSM — Comparison
| Feature | FLSM | VLSM |
|---|---|---|
| Subnet sizes | All equal (same prefix length) | Variable (different prefix lengths) |
| IP efficiency | Wasteful — small subnets get same size as large ones | Efficient — each subnet sized to actual needs |
| Calculation complexity | Simple — one calculation applied to all | More complex — separate calculation per subnet |
| Protocol requirement | Works with classful (RIPv1) and classless protocols | Requires classless protocols (OSPF, EIGRP, RIPv2, BGP) that carry subnet mask in updates |
| Routing table | Fewer entries (all same size, may summarise easily) | More entries (variable sizes, more complex summarisation) |
| Use case | Simple, uniform networks with similar-sized segments | Modern enterprise networks with mixed segment sizes (LAN, WAN links, DMZ, management) |
9. CIDR Notation and Classless Addressing
CIDR (Classless Inter-Domain Routing) was introduced in 1993 to replace the rigid class-based system. Instead of fixed /8, /16, /24 boundaries, CIDR allows any prefix length from /0 to /32.
CIDR notation: IP_address / prefix_length Example: 192.168.1.0/26 The /26 tells you: 26 bits are the network portion. Remaining 32-26 = 6 bits are the host portion. CIDR replaces: Old classful: "This is a Class C network with mask 255.255.255.0" New CIDR: "This is a 192.168.1.0/26 subnet" -- mask is explicit CIDR enables: 1. Subnetting within any class boundary 2. Supernetting across class boundaries (route aggregation) 3. ISPs allocating address blocks of any size to customers CIDR blocks assigned by ISPs: Customer A gets: 203.0.113.0/25 (126 hosts) Customer B gets: 203.0.113.128/26 (62 hosts) Customer C gets: 203.0.113.192/27 (30 hosts) ISP summarises all as: 203.0.113.0/24 to upstream internet
10. Supernetting and Route Summarisation
Supernetting (also called route summarisation or route aggregation) is the opposite of subnetting — it combines multiple contiguous smaller networks into a single, larger summary route. This reduces the number of routing table entries, speeds up routing lookups, and hides topology changes.
Supernetting example: combine four /24 networks into one summary
Networks to summarise:
192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24
Step 1: Write all network addresses in binary (third octet):
192.168.0.0 = 192.168. 00000000 .0
192.168.1.0 = 192.168. 00000001 .0
192.168.2.0 = 192.168. 00000010 .0
192.168.3.0 = 192.168. 00000011 .0
^^
Last 2 bits differ -> common prefix = 22 bits
Step 2: Summary address = common bits + remaining zeros
192.168.00000000.0 = 192.168.0.0
Summary route: 192.168.0.0/22
This one route covers all four /24 networks.
Any destination matching 192.168.0-3.x is forwarded via this route.
Requirement: Networks must be CONTIGUOUS and be a power-of-2 block
starting on an aligned boundary.
192.168.0.0/22 covers .0.x through .3.x (exactly 4 x /24 = valid)
192.168.1.0/22 would NOT be valid -- .1 is not aligned to a /22 boundary
Practical Summarisation on Cisco IOS
! OSPF manual summarisation at an ABR (Area Border Router): Router(config-router)# area 1 range 192.168.0.0 255.255.252.0 ! Summarises 192.168.0.0/24 through 192.168.3.0/24 as 192.168.0.0/22 ! EIGRP manual summarisation on an interface: Router(config-if)# ip summary-address eigrp 1 192.168.0.0 255.255.252.0 ! Static summary route pointing to Null0 (leak prevention): Router(config)# ip route 192.168.0.0 255.255.252.0 Null0
11. Private IP Address Ranges
RFC 1918 reserves three address ranges as private — they are not routed on the public internet and can be reused freely within any organisation. NAT (Network Address Translation) converts private addresses to a public IP for internet access.
| Class | Private Range | CIDR | Number of Addresses | Common Use |
|---|---|---|---|---|
| A | 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Large enterprises, data centres, cloud VPCs |
| B | 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Medium enterprises, service provider customer networks |
| C | 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 | Small offices, home networks, lab environments |
See Private vs Public IP Addresses for NAT configuration and internet routing details.
12. Finding the Network, Host Range, and Broadcast — Rapid Method
The fastest exam technique for determining the subnet details of a given IP address and mask does not require binary conversion for the common /24-to-/30 range.
Problem: What network does 10.10.50.77/28 belong to? What are the first host, last host, and broadcast? Step 1: Identify block size /28 -> mask = 255.255.255.240 -> last octet = 240 Block size = 256 - 240 = 16 Step 2: Find the subnet boundary Divide the host octet (77) by the block size (16): 77 / 16 = 4 remainder 13 -> subnet starts at 4 x 16 = 64 Network address: 10.10.50.64 (64 is the multiple of 16 <= 77) Broadcast address: 10.10.50.79 (next multiple - 1: 80 - 1 = 79) First usable host: 10.10.50.65 (network + 1) Last usable host: 10.10.50.78 (broadcast - 1) Verification: 77 is between 65 and 78 -- confirmed, IP is in this subnet. Another example: 172.16.5.200/29 Block size = 256 - 248 = 8 200 / 8 = 25 remainder 0 -> subnet starts at 25 x 8 = 200 Network: 172.16.5.200 Broadcast: 172.16.5.207 First: 172.16.5.201 Last: 172.16.5.206
13. Exercises — Fully Solved
Exercise 1: FLSM — Subnet 192.168.10.0/24 into 4 equal subnets
| Subnet | Network Address | Usable IP Range | Broadcast | Subnet Mask |
|---|---|---|---|---|
| 1 | 192.168.10.0/26 | .1 – .62 | .63 | 255.255.255.192 |
| 2 | 192.168.10.64/26 | .65 – .126 | .127 | 255.255.255.192 |
| 3 | 192.168.10.128/26 | .129 – .190 | .191 | 255.255.255.192 |
| 4 | 192.168.10.192/26 | .193 – .254 | .255 | 255.255.255.192 |
Exercise 2: VLSM — Subnet 172.16.20.0/24 for given requirements
| Subnet | Hosts Needed | Network Address | CIDR | Mask | Usable Range | Broadcast |
|---|---|---|---|---|---|---|
| A | 50 | 172.16.20.0 | /26 | 255.255.255.192 | .1 – .62 | .63 |
| B | 30 | 172.16.20.64 | /26 | 255.255.255.192 | .65 – .126 | .127 |
| C | 12 | 172.16.20.128 | /28 | 255.255.255.240 | .129 – .142 | .143 |
| D | 6 | 172.16.20.144 | /29 | 255.255.255.248 | .145 – .150 | .151 |
14. Key Points & Exam Tips
- Usable hosts formula: 2^h − 2 where h = host bits (32 − prefix). Always subtract 2 for network address and broadcast address.
- Block size = 256 − last octet of subnet mask. This is the increment between consecutive subnet network addresses.
- Network address = all host bits set to 0. Broadcast address = all host bits set to 1.
- FLSM: all subnets same size; simple; works with classful or classless protocols. VLSM: variable sizes; requires classless protocols (OSPF, EIGRP, RIPv2, BGP).
- VLSM order: always allocate largest subnet first to avoid overlap.
- Memorise the table for /24 through /30: usable hosts are 254, 126, 62, 30, 14, 6, 2 respectively.
- /30 for point-to-point WAN links — 2 usable hosts, no waste. /31 (RFC 3021) is also used on modern Cisco equipment for WAN links.
- Supernetting rule: networks must be contiguous AND start on an aligned power-of-2 boundary. Four /24s can summarise only if the first is a multiple of 4 (e.g., .0, .4, .8, .12... — NOT .1, .2, .3).
- Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. Not routed on the public internet; used with NAT.
- Rapid method: divide host octet by block size; multiply the quotient by block size to get the network address; add block size − 1 to get the broadcast address.
Related pages: Private vs Public IP Addresses | Default Routes | Static Routing Configuration | DHCP How It Works | OSPF Overview | NAT / PAT Overview | OSPF Single-Area Lab (uses subnetting) | DHCP Server Configuration Lab