Bootstrap FreeKB - Linux Fundamentals - Understanding CIDR
Linux Fundamentals - Understanding CIDR

Updated:   |  Linux Fundamentals articles

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
Class A 1.0.0.1 126.255.255.254 255.0.0.0 /8
Class B 128.1.0.1 191.255.255.254 255.255.0.0 /16
Class C 192.0.1.1 223.255.254.254 255.255.255.0 /24

 

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
Class A 16,777,214
Class B 65,534
Class C 254

 


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 12.34.56.78. 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
10.x.x.x
172.16.x.x - 172.32.x.x
192.168.x.x

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 73cc6e in the box below so that we can be sure you are a human.