TTR Networks

What is CIDR?

Classless Inter-Domain Routing

CIDR (Classless Inter-Domain Routing) is writing and routing IP networks as an address plus a prefix length, such as 192.0.2.0/24, instead of fixed classes.

Before CIDR, IPv4 networks came in three main sizes: class A (/8), class B (/16) and class C (/24), with the class decided by the first bits of the address. That wasted space, because an organisation needing 2,000 addresses had to take a whole class B of 65,536, and it bloated the internet routing table with thousands of separate class C routes. CIDR, introduced in the early 1990s and now described in RFC 4632, dropped the classes. The number after the slash says how many leading bits are the network part, and the rest identify hosts: a /24 has 8 host bits and 256 addresses, a /26 has 64, a /30 has 4. Any length from /0 to /32 is allowed, so networks can be sized to fit.

The second half of the name, routing, matters just as much. Because prefixes no longer have fixed boundaries, adjacent blocks can be summarised into one shorter prefix: 198.51.100.0/25 and 198.51.100.128/25 together are exactly 198.51.100.0/24, so a provider can announce one route for many customers. Routers then forward using longest-prefix match, choosing the most specific route that covers the destination. Beginners often trip over alignment: 198.51.100.64/24 isn't a valid network address, because a /24 must start on a multiple of 256. IPv6 uses the same notation, as in 2001:db8::/32. CIDR blocks are what RIRs allocate and what BGP announces. The Switching basics lesson shows how prefixes and default gateways decide whether a packet stays on the LAN.