top of page
lp.jpeg

Blog

Tags:

What is CIDR (Classless Inter-Domain Routing) in MuleSoft VPC



Introduction


CIDR stands for Classless Inter-Domain Routing and it’s a way of allocating IP addresses or hosts in a more efficient manner. It replaces the old way of allocating IP addresses based on the class system. This method allocates the IP Addresses or hosts in a more efficient way and avoids the waste of IP Addresses.


  • Class A: 16 million host identifiers or IP Addresses.

  • Class B: 65,535 host identifiers or IP Addresses.

  • Class C: 254 host identifiers or IP Addresses.


Let's consider the Organization requires around 500 IP Addresses or Hosts. In such cases, organizations have to go with a Class B IP distribution system where almost more than 60,000 IP addresses are wasted.




What is an IP Address?


IP Addresses consist of two groups of bits in the address, the most significant bits are network the prefix, which identifies the network or subnet; and the least significant bits are the host identifier, which specifies a particular interface of the host on that network.


IP Addresses have 2 components:

  1. Network Address

  2. Host Address


Each IP Address (IPv4) is 32 bit or 4 Octet. Below is the representation of an IP Address in Binary:



CIDR Block Notation:

xxx.xxx.xxx.xxx/n

where n is the number of bits used for the subnet mask.


The subnet mask is made up of setting up all network bits to all ones and host bits to all zeros.


Let's consider this scenario: if you provide this CIDR Block 192.168.0.0/24, it will give 255 hosts or IP addresses.




What is a Subnet?


A subnetwork or subnet is a logical subdivision of an IP network. The practice of dividing a network into two or more networks is called subnetting. Computers that belong to a subnet are addressed with an identical most-significant bit-group in their IP addresses.


Now, we will see how to Calculate the total number of hosts using Subnet Mask.



Use Case 1


Subnet Mask 192.168.0.0/24 will equate to IP Range 192.168.0.0 — 192.168.0.255.



N represents Network and H represents Host. In the above example, we made 24 bits to ones and the remaining 8 bits to zeros because the Subnet Mask end range is 24. Total zeros are 8 for Host (2*2*2*2*2*2*2*2=256).


This will give an IP range of 192.168.0.0 — 192.168.0.255 (256 Hosts in total).



Use Case 2


Subnet Mask 192.168.0.0/23 will equate to IP Range 192.168.0.0 — 192.168.0.511.



N represents Network and H represents Host. In the above example, we made 23 bits to ones and the remaining 9 bits to zeros because the Subnet Mask end range is 23. Total zeros are 9 for Host (2*2*2*2*2*2*2*2*2=512).


This will give an IP range of 192.168.0.0 — 192.168.0.511 (512 Hosts in total).



Use Case 3