CIDR
What is CIDR
CIDR (Classless Inter-Domain Routing) is a network subnet representation that allows variable length subnetting. It consists of a base IP address and an integer specifying the size of the subnet. It replaced Classful Networking in 1993.
Classful Networks
Prior to 1993, the internet was made up of Classful subnets. These consisted of classes defined based on octet (8 bit) boundaries. Class A addresses had a subnet mask of 255.0.0.0, Class B addresses had a subnet mask of 255.255.0.0 and Class C address had a subnet mask of 255.255.255.0. The leading bits of the IP address determined which class the address belonged to. If the leading bit (most significant bit) was clear, it was a Class A address. If the leading bit was set and the second but was clear, it was a Class B address. If the leading bit was set and the second bit was set and the third bit was clear, it was a Class C address.
The subnet mask was often determined from the class of the IP address. The table below shows the default subnet masks for each class.
Class | Leading Bits | Start Address | End Address | Default Subnet Mask | Equivalent CIDR Mask |
---|---|---|---|---|---|
Class A | 0 | 0.0.0.0 | 127.255.255.255 | 255.0.0.0 | /8 |
Class B | 10 | 128.0.0.0 | 191.255.255.255 | 255.255.0.0 | /16 |
Class C | 110 | 192.0.0.0 | 223.255.255.255 | 255.255.255.0 | /24 |
Class D (multicast) | 1110 | 224.0.0.0 | 239.255.255.255 | Not Defined | Not Defined |
Address from 240.0.0.0 to 255.255.255.255 were (and still are) reserved. Also note that there are many reserved ranges within the ranges above. The main ones are:
Reserved Range | Reason |
---|---|
0.0.0.0 - 0.255.255.255 | Specifies "This" network |
10.0.0.0 - 10.255.255.255 | Private IP addresses |
127.0.0.0 - 127.255.255.255 | Local host (loopback addresses) |
169.254.0.0 - 169.254.255.255 | Link Local addresses |
172.16.0.0 - 172.31.255.255 | Private IP addresses |
192.168.0.0 - 192.168.255.255 | Private IP addresses |
For more information, and a complete list of reserved IP address ranges, see RFC3330 - Special-Use IPv4 Addresses.
Class A subnets provided a total of 16,777,216 address, Class B subnets had 65,536 addresses and Class C subnets had 256 addresses. Note that with a subnet, the first address and last address are the network address and the broadcast address and cannot be assigned to hosts. So the actual number of usable addresses is the total number of addresses minus two.
Classful subnets had routing entries for each subnet. Since there were a possible 2,097,152 Class C subnets alone, this made for a lot of routing rules.
It wasn't until the introduction of classless networks that this system became known as classful subnetting.
Classless Networks
The way classful networks were allocated was very rigid. It was hard to manage IP address allocation this way. In 1993 Classless Inter-Domain Routing (CIDR) was implemented. CIDR allows subnets of any size (providing the size is 2n) from any available IP address range. CIDR also allows agregation of routing rules which greatly reduced the number of rules in routing tables.
CIDR format consists of a base IP address and an integer. The integer specifies the number of bits which are fixed (ie. form the network ID), starting from the most significant bit. CIDR allows variable length subnet masking, although with the introduction of VLSM (Variable Length Subnet Masking) most systems now also support variable length dotted decimal subnet masks as well.
This table shows some CIDR examples:
CIDR | Start Address | End Address | Dotted Decimal Netmask | Number of Addresses |
---|---|---|---|---|
10.0.0.0/8 | 10.0.0.0 | 10.255.255.255 | 255.0.0.0 | 16,777,216 |
172.16.0.0/12 | 172.16.0.0 | 172.31.255.255 | 255.240.0.0 | 1,048,576 |
192.0.2.0/24 | 192.0.2.0 | 192.0.2.254 | 255.255.255.0 | 256 |
With classless networks, the terms Class A, Class B and Class C are still commonly used. But now they just refer to the size of the subnet and not the range the addresses come from.