Classless Inter-Domain Routing represents an address range with a prefix length instead of relying on historical address classes. CIDR supports variable-sized allocations, subnetting, and route aggregation for IPv4 and IPv6.
Subnetting · Lesson 5
CIDR
Learn how CIDR prefixes represent address ranges, subnet boundaries, and aggregated routes.
Reading Prefix Notation
In 10.42.3.17/24, the first 24 bits are the network prefix and eight bits remain for positions within the range. The canonical network is 10.42.3.0/24; the supplied host address can still be written with the prefix when configuring an interface.
What does /24 specify in an IPv4 CIDR value?
Calculating Range Size
IPv4 prefix /23 leaves nine host bits and therefore covers 2^9 = 512 total addresses. The aligned prefix 123.12.24.0/23 spans:
first: 123.12.24.0
last: 123.12.25.255
In traditional broadcast use, the first is the network address and the last the directed broadcast. Do not apply the “minus two” usable-host shortcut blindly to /31 point-to-point or /32 host routes.
How many total IPv4 addresses does a /23 contain?
Checking Alignment
A prefix must begin on its binary boundary. A /23 advances in blocks of two in the third octet when earlier octets are fixed, so 123.12.24.0/23 is aligned but 123.12.25.0/23 canonicalizes to the same 123.12.24.0/23 range.
What is the canonical /23 network containing 123.12.25.0?
Aggregating Routes
CIDR can advertise one aggregate for several contiguous, equally sized, correctly aligned prefixes. For example, 192.0.2.0/25 and 192.0.2.128/25 combine into 192.0.2.0/24. Aggregation is safe only when the advertising router can correctly reach the complete aggregate or has policy to prevent loops and black holes.
Which aggregate covers both halves of 192.0.2.0/24?
Longest-Prefix Routing
When routes overlap, forwarding normally selects the eligible route with the longest matching prefix. A /24 route is more specific than a covering /16, while a default route /0 matches only when no more-specific eligible route wins.
For destination 10.42.3.8, which eligible route is more specific?
Lesson complete
You finished CIDR
You can now use CIDR notation for both address ranges and route selection.
Interpret the slash value as a leading prefix-bit count.
Calculate total range size from remaining bits.
Canonicalize a prefix to its aligned network boundary.
Aggregate only contiguous aligned ranges with valid reachability.
Prefer the longest eligible prefix during route lookup.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account