IP Address Classes and Classless Routing: A Practical Guide
Most networks you touch today run with classless prefixes, yet the old A/B/C classes still shape how people think about addresses and masks.
We’ll connect the two worlds in plain terms, show how to carve address space with confidence, and then compress many routes into a single summary that routers prefer.
Keep a notepad handy: the quickest way to master this is to work through a few small, repeatable patterns you can reuse in labs and production.
Classful Addressing in Context
Classful addressing split IPv4 into fixed ranges with fixed default masks; it’s historical but still helpful for decoding legacy defaults and behaviors on old protocols and devices.
Default Masks and Ranges
Class A used a default mask /8 and historically described addresses with first octet 1–126 as assignable; 127.0.0.0/8 is loopback-only and 0.0.0.0/8 was reserved for “this network,” so neither was assignable; Class B used /16 with first octet 128–191; Class C used /24 with first octet 192–223; Class D (224.0.0.0–239.255.255.255) was defined for multicast and Class E (240.0.0.0–255.255.255.255) reserved for future or experimental use, not unicast.
Private-use ranges defined by standards and common practice are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16; you also see 169.254.0.0/16 as link-local when DHCP fails.
Why the Legacy Still Matters
RIPv1 and certain older defaults infer masks from the class, not the prefix length, which breaks discontiguous designs; knowing the classful defaults helps you spot unintended summaries or missing masks when troubleshooting.
CIDR and Why Classless Won
Classless Inter-Domain Routing (CIDR) uses a prefix length—/n—to describe how many leading bits are fixed, which reduces waste and enables route aggregation across arbitrary boundaries.
Slash notation is unambiguous: 192.0.2.0/25 means 128 addresses (126 usable), while 192.0.2.0/24 means 256 addresses (254 usable), regardless of any class.
Longest Prefix Match
Routers forward using the most specific route that matches the destination (longest prefix match, LPM); a /30 beats a /24, which beats a /16, which beats 0.0.0.0/0, even if a shorter route was installed earlier.
Subnetting Step-by-Step
Subnetting borrows host bits to create more networks; the repeatable workflow is: define needs, choose a mask, compute the block size, enumerate networks, and assign logically.
Five-Step Method
1) Start with a base prefix, for example 10.0.0.0/24. 2) Decide how many subnets and hosts per subnet you need; say six subnets, at least 20 hosts each. 3) Compute host bits: 2^5=32 addresses per subnet gives 30 usable, so a /27 works. 4) Block size is 32 in the last octet, so network IDs are 10.0.0.0, .32, .64, .96, .128, .160, .192, .224. 5) Assign subnets to sites or VLANs, leaving gaps where you expect growth.
VLSM Planning Workflow
Variable Length Subnet Masking (VLSM) applies the same idea recursively so big needs get big blocks and tiny needs get tiny blocks from the leftovers; sort subnets by size, allocate from largest to smallest, and keep boundaries aligned to their block size for clean summaries.
Worked VLSM Example
Given 172.16.50.0/24, carve three subnets: one for 90 hosts (/25), two for 25 hosts (/27 each), and a point-to-point link (/30). Allocate 172.16.50.0/25 to the largest LAN, then 172.16.50.128/27 and 172.16.50.160/27 to smaller LANs, and 172.16.50.192/30 for the WAN; you still have 172.16.50.196–.255 available for future needs if you maintain alignment.
Route Summarization and Aggregation
Summarization compresses many specific routes into one advertisement, shrinking routing tables and speeding convergence while containing instability inside the summary.
How to Find a Good Summary
Convert candidate networks to binary and count the common leading bits; that count is the new prefix length and the summary’s network address is those common bits with the rest set to zero.
Two Fast Rules
Only summarize contiguous blocks that align to the new prefix length, and always check that you aren’t accidentally pulling an out-of-range network into the aggregate.
Summarization Examples
Eight contiguous /24s from 172.16.8.0/24 through 172.16.15.0/24 form 172.16.8.0/21 (8 blocks × 2^(24–21)=8), because 8–15 is a block of eight aligned on a /21 boundary.
Two /26s, 192.0.2.0/26 and 192.0.2.64/26, combine into 192.0.2.0/25; adding 192.0.2.128/26 breaks that summary unless you jump to 192.0.2.0/24, which also includes 192.0.2.192/26.
Where to Summarize in the Topology
Summarize at OSPF area borders (inter-area on ABRs and external on ASBRs), at distribution edges in hierarchical designs, and on BGP edge routers with explicit aggregate statements and route-maps or policies to manage attributes.
Classful vs. Classless Routing Protocol Behavior
RIPv1 is classful and doesn’t include masks, so it auto-summarizes at classful boundaries and can’t carry discontiguous or VLSM subnets; RIPv2, OSPF, IS-IS, EIGRP, and BGP are classless and include masks or prefix lengths, so they carry VLSM and supernets.
Auto-Summary Gotchas
Early EIGRP and some RIP deployments enabled auto-summary by default; mixing the same major network (for example 10.0.0.0/8) across separated sites could blackhole traffic because devices injected a classful 10.0.0.0/8 summary toward the core; modern software typically has auto-summary disabled by default, but you should verify and explicitly disable it when you require classless behavior.
Design Patterns You Can Reuse
Per-site blocks: hand out a /22 to small branches, a /21 to big branches, and a /18 to a campus; inside each site, use VLSM to size user VLANs (/24 to /23), voice (/24), management (/26), and point-to-point WANs (/30 or /31) while keeping a buffer for growth.
WAN links: use /31 on IPv4 point-to-point links where both ends support it; it halves address waste and still summarizes cleanly with nearby subnets.
DMZs and services: isolate with dedicated prefixes so you can summarize them separately and filter with straightforward prefix-lists and ACLs.
Operational Hygiene
Document every allocation with the prefix, purpose, gateway, and requester; reserve stable addresses for first-hop redundancy where your standards call for it; never reuse blocks until you’ve removed all references from ACLs, NAT, DHCP, and monitoring.
Troubleshooting Subnets and Summaries
If hosts can’t reach outside, check the mask first and the default gateway second; a /26 mistyped as /25 silently blackholes traffic beyond the first 64 addresses.
If only some destinations fail, print the routing table and confirm that a summary isn’t hiding a more specific route learned from another path; remember LPM—more specific should win—and prefer consistent summarization boundaries on both sides of critical links to avoid asymmetric paths.
When the same sub-blocks appear in two places, overlapping allocations cause oscillation and stateful firewall breakage; fix the addressing, then re-introduce summaries carefully.
Quick Mental Math Aids
Memorize block sizes in the last octet for common masks: /24→256, /25→128, /26→64, /27→32, /28→16, /29→8, /30→4; the first address is the network, last is broadcast, and usable hosts sit between.
From Lab to Production
Start with a clean seed block, for example 10.32.0.0/16 for a region; assign /20 per large site (4096 addresses, 4094 usable), /22 per medium site, and /24 per small site; summarize each site block toward the region, summarize the region toward the core, and publish only minimal aggregates to upstream peers.
Change Control and Rollback
Stage summarization in three steps: 1) inject specifics and the summary concurrently, 2) verify traffic prefers the intended path while LPM still covers exceptions, 3) withdraw specifics after stability; keep a prebuilt rollback to restore specifics if monitoring shows unexpected loss or path changes.
Security and Policy Interactions
Summaries simplify filters but also widen them; refine with more specific permit or deny statements where needed, and ensure NAT pools match the actual prefixes you intend to advertise so that return traffic follows the same aggregates.
Checklist Before You Ship
Confirm all subnets are non-overlapping, boundaries align to their block size, summaries don’t pull in foreign space, dynamic routing masks are visible end to end, and any auto-summary features are disabled unless explicitly required.
What Usually Backfires
Trying to summarize across discontiguous sites, mixing provider-assigned and privately summarized blocks inside the same aggregate, and using asymmetric summaries around stateful devices are the recurring patterns that waste the most time.
