Prior to CIDR
To understand CIDR, you must first understand that prior to CIDR, an IP address would be within a certain class; Class A, Class B, or Class C. You would know your class based on your public IP address. Each class had one subnet mask, meaning that you were unable to have more than one subnet.
|Class||First available IP Address||Last available IP address||Subnet Mask||Prefix|
This created a problem - wasted, or unused IP addresses. For example, lets say an organization needs 1,000 public IP addresses. In thiis situation, the organization would need a Class B IP address. Because each Class B IP address provides 65,534 unique IP address per subnet, in this example, over 64,000 IP address would never be used.
|Class||Number of available hosts per IP address|
CIDR (Public IP addresses)
As more and more organizations (and home users) required a public IP address, it didn't take long before all of the available IPv4 addresses would be allocated. Classless Inter Domain Routing (CIDR) was introduced, as a way to reduce or eliminate unused IP addresses.
Lets take for example the situation where an organization needs 1,000 public IP addresses. Instead of providing a Class B address with subnet mask 255.255.0.0 (prefix /16), the ISP could apply subnet mask 255.255.252.0 (prefix /22) to the public IP address. This would divide the public IP address into 64 subnets, where each subnet has 1,024 unique IP addresses. This greatly reduces wasted IP addresses. In this example, the organization that needs 1,000 public IP addresses could be allocated IP addresses from 1 of the 64 subnets. The IP addresses in the remaining 63 subnets could be allocated to other organizations that also require 1,000 public IP addresses.
CIDR (Private IP addresses)
Recall that Network Address Translation (NAT) is used to translate a public IP address into a private IP address, and vice versa.
If using 10.x.x.x, your private IP addresses are not limited to a certain class. While it is true that an IP address beginning with 10.x.x.x would be a Class A IP address, 10.x.x.x can use any subnet mask.
If using 172.16.x.x - 172.32.x.x or 192.168.x.x, you can use any subnet mask greater than /16. You would not be able to use /15 or below, because the first 16 bits are already accounted for in the private IP address.
For example, let's say your public IP address is 126.96.36.199. This public IP address is a Class A IP addresses. In your LAN, you could use private IP address 10.x.x.x (Class A) or 172.16.x.x. (Class B) or 192.168.x.x (Class C)..You can also select any subnet mask you would like for your private IP addresses.
|Private IP Address range|
|172.16.x.x - 172.32.x.x|