Simplified CIDR — Classless Inter-Domain Routing
As we all know that CIDR stands for Classless Inter-Domain Routing. But what more important is to understand it completely from the basic to advance and that also to be quick and easy to understand. If we are on the same page, follow me along with this post. Let’s get started! :)
Let’s start with the definition of CIDR and then we will go deeper into every aspect that you would need to know about it.
What is CIDR?
CIDR (Classless Inter-Domain Routing) is an alternate method of representing a subnet mask. It is simply a count of the number of network bits (bits that are set to 1) in the subnet mask.
The CIDR value is typically preceded by a slash “/” and follows the IP address.
For example, an IP address of 192.168.0.0 with a subnet mask of 255.0.0.0 (which has 8 network bits) would be represented as 192.168.0.0 /8.
In other words, based on our requirements we can limit our network systems by freezing some limits with the help of IP addresses. As we will proceed with this post, you will get a better idea!
Why CIDR?
IP addresses are limited. It’s not a good idea to waste a single IP address even in the respective network. Let us discuss this further to get it clearer!
In the classful addressing, the no of Hosts within a network always remains the same depending upon the class of the Network. Below are the nos of the hosts based on the classes.
Class A network contains 2²⁴ Hosts
Class B network contains 2¹⁶ Hosts
Class C network contains 2⁸ Hosts
let’s assume that an organization requires 2¹⁴ hosts, then it must have to purchase a Class B network. In this case, 49152 Hosts will be wasted and this is the major drawback of Classful Addressing.
The main reason for the introduction of CIDR is to reduce the wastage of IP addresses. IANA (Internet Assigned Numbers Authority) uses this technique to provide the IP addresses.
The reason it’s “classless” is that it allows a way to break IP networks down more flexibly than their base class.
Let’s get dipper into CIDR:
CIDR was defined to allow Variable Length Subnet Masks (VLSM) to be applied to networks. As the name applies, address groups, or networks, can be broken down into groups that have no direct relationship to the natural “class” they belong to.
The basic premise of VLSM is to provide the count of the number of network bits in a network. Since an IPv4 address is a 32-bit integer, the VLSM will always be between 0 and 32.
Rules for CIDR Block:
In order to make a valid IP address block, it needs to follow the below 3 rules:
Rule 1 — All IP addresses which are allocated to the host must be continuous. You cannot skip.
Rule 2 — The size of the block must be divisible by the first IP address of the block. This means the least significant part should always start with zeroes in Host Id.
Rule 3 — The block size must be of power 2 and equal to the total number of IP addresses.
Now, we are very much familiar with the IP blocks, let's have a look at different IP versions.
IPV4 -12 digit decimal -32 bits binary
IPV5 -Not for public use, it is used for research and high computing
IPV6 -People are not using this for general purpose
Let’s do some exercise on how to calculate nos of IP address possible?
10.0.0.0/28
Total freezing value = 32
32–28 = 4
2⁴ = 16 -That’s 16 IP addresses are possible for 10.0.0.0/28 subnet mask 10.0.0.0 — Reserved for network address
10.0.0.15 — Reserved for broadcast
105.0.1.0/24
Total freezing block = 32
32–24 = 8
2⁸ = 256 -That’s 256 IP addresses are possible for 105.0.1.0/24 subnet mask
105.0.1.0 — Reserved for network address
105.0.1.255 — Reserved for broadcast
Now let’s calculate the IP range for nos of subnets:
198.162.0.0/16 — Let’s say I want 256 IPs x 3 subnet
198.162.0.0/16 — Freeze
Ask yourself — how many IPs per block? -> 256
256 -> If we can calculate 2⁸ then we can accumulate 256
32–8 = 24 — Which is nothing but our freezing block /24
Ask yourself — how many IP blocks you want -> 3
198.162.0.0/24–198.162.0.255/24 First subnet block
198.162.1.0/24–198.162.1.255/24 Second subnet block
198.162.2.0/24–198.162.2.255/24 Third subnet block
The above calculation is useful if you want to calculate the same manually. If you want to get the above calculations done with the help of online utilities, you can consider the below links: