WHAT IS CIDR?
Photo from Pixabay
Originally Posted On: https://ipv4.global/blog/what-is-cidr/
Pronounced “cider,” CIDR stands for Classless Inter-Domain Routing. CIDR is a method for summarizing IP addresses. Its original goal was to slow the exhaustion of IPv4 addresses and help extend the life of IPv4. It also improved the efficiency of IP address assignments, and overall significantly improved the availability.
Before we cover how CIDR works, it’s important to understand the technology that CIDR replaced.
Before CIDR: Class-based IP addresses
In the early 1990s, Internet engineers realized they were going to run out of IPv4 addresses. Until then, they had been allocating addresses in one of three block sizes, known as Classes. A Class C block had 256 addresses, a Class B block had 65,536 addresses, and a Class A block had 16,777,216 addresses. If you needed more than one or two Class C blocks, you got a Class B, and so on.
Consider the anatomy of an IPv4 address:
192.0.2.16 or 11000000000000000000001000010000
The format on the left is called “dotted decimal” or “dotted quad” notation. Each number is a regular (base 10) number from 0 to 255. The format on the right is the same number in binary.
The network number is the first address. In dotted decimal, it always ends in zero[1]. (The network number for subnets of a Class C can end in other numbers, like 192.0.2.32/27, which means you can assign very few addresses to a network, but assignments from the registries are never smaller than Class C). In binary, the first bits would identify the class of IPv4 address. Technically, if the first bit was 0, it was a Class A block, or 0.0.0.0 – 127.255.255.255.
If the first two bits were 01, it was a Class B block, or 128.0.0.0 – 191.255.255.255.
If the first two bits were 11, it was a Class C block, or 192.0.0.0 – 223.255.255.255.
Class D was reserved for multicast, and class E for experimentation; you will never see them.
With only 128 possible Class As, and 65,536 possible Class Bs, by the early 1990s, it was clear that more specific allocations would be required. So, the class system was demolished and we moved to a classless system.
In Classful numbering, it’s easy to recognize the class from the address: a Class A is identified by the first byte (10.0.0.0), a Class B is identified by the first two bytes (172.16.0.0 and 172.17.0.0 are different Class B blocks) and a Class C by the first three bytes (192.186.1.0 and 192.186.2.0 are different Class C blocks). But, in Classless numbering, the number of bits identifying a block can be any of the 32 bits.
192.0.2.16 or 11000000.00000000.00000010.00010000
If that address was part of a /24 (“slash twenty-four”), the first 24 bits define the network block, and the last 8 bits are used for individual devices. You would write the network as 192.0.2.0/24, which tells you that the possible addresses are 192.0.2.0 – 192.0.2.255. The number after the slash tells you how many bits are used to define the network.
That’s distinct from a /20:
192.0.2.16 or 11000000.00000000.00000010.00010000
The network is 192.0.0.0/20, with possible addresses from 192.0.0.0 – 192.0.15.255.
Some addresses in this same /20 network:
192.0.0.0 11000000.00000000.00000000.00000000
192.0.2.16 11000000.00000000.00000010.00010000
192.0.13.127 11000000.00000000.00000111.01111111
192.0.15.255 11000000.00000000.00001111.11111111
A network can be subnetted.
192.0.0.0/20 also contains:
192.0.0.0/21
192.0.8.0/21
Or, 192.0.0.0/20 also contains:
192.0.0.0/24
192.0.1.0/24
192.0.2.0/24
192.0.3.0/24
192.0.4.0/24
192.0.5.0/24
192.0.6.0/24
192.0.7.0/24
192.0.8.0/24
192.0.9.0/24
192.0.10.0/24
192.0.11.0/24
192.0.12.0/24
192.0.13.0/24
192.0.14.0/24
192.0.15.0/24
The main thing to remember is that networks can be subnetted. The smallest network that can be bought, sold, transferred, or generally routed on the Internet is a /24. You will need to refer to this chart often:
Because of the inefficiencies of the class system, CIDR became the solution.
CIDR Structure
With CIDR, assigning addresses is more efficient as engineers can divide an IP address into subnets, without using many addresses. CIDR addresses have two sets of numbers:
- Prefix—this is the binary representation of the network address, similar to a normal IP address.
- Suffix—this states the total number of bits in an address.
For example, a CIDR address might look like: 192.168.125.23/16
So this network has 16 bits.
And as you may know, IPv4 addresses can have up to 32 bits. CIDR is also used for IPv6, with /64, /48, and /32 prefixes being common; IPv6 addresses can go up to 128 bits.
CIDR and Supernetting
Companies can take advantage of CIDR’s supernetting. When different parts of the corporate network have /27 networks, a few /24s, and a /23, all of those subnets may be part of one /22 supernet. Your home ISP may only have assigned you one address (a /32 network), but may be summarizing all of their customers as one or more /16s.
Conclusion
CIDR is an efficient way to make the most of your IPv4 addresses. If you’d like more information on the differences between IPv4 vs. IPv6 check out this blog, or if you’d like to learn more about renumbering your network more efficiently so you can sell off some of your IPv4 addresses, please reach out to us today.