CIDR (Classless Inter-Domain Routing) is a method used in modern networking to allocate and manage IP addresses more efficiently than the older classful networking system. It allows for flexible subdivision of IP address space and more precise allocation of network resources.
In CIDR, the traditional concept of IP address classes (A, B, C, etc.) is replaced by a notation that combines the IP address with a slash (/) followed by a number, known as the prefix length or subnet mask. The prefix length represents the number of bits in the network portion of the IP address.
To move between a full network mask and the /# CIDR format we simply have to understand how many “bits” of an IP address are being used as the network address
Class A
Network mask: 255.0.0.0
Binary: 11111111.00000000.00000000.00000000.00000000
CIDR: /8 (there are 8 “bits” denoting the network address)
Class B
Network mask: 255.255.0.0
Binary: 11111111.11111111.00000000.00000000
CIDR: /16 (there are 16 “bits” denoting the network address)
Class C
Network mask: 255.255.255.0
Binary: 11111111.11111111.11111111.00000000
CIDR: /24 (there are 24 “bits” denoting the network address)
When we want to demonstrate how CIDR provides flexibility to networking, lets assume that we are currently on a /24 network but we want to make it a smaller environment. This would look like the following:
Original /24 network Details (192.168.1.0/24)
192. 168. 1. 0 : IP
11111111.11111111.11111111.00000000 : Netmask
Network Host
IP addresses: 192.168.1.0 – 192.168.1.255
Netmask: 255.255.255.0
Network address: 192.168.1.0 (where the host address is set to all 0’s)
Broadcast address: 192.168.1.255 (where the host address is set to all 1’s)
Useable IP addresses: 192.168.1.1 – 192.168.1.254 (254 hosts can be on this network)
New /25 network Details (192.168.1.0/25)
192. 168. 1. 0 : IP
11111111.11111111.11111111.10000000 : Netmask
Network Host
IP addresses: 192.168.1.0 – 192.168.1.127
Netmask: 255.255.255.128
Network address: 192.168.1.0 (where the host address is set to all 0’s)
Broadcast address: 192.168.1.127 (where the host address is set to all 1’s)
Useable IP addresses: 192.168.1.1 – 192.168.1.126 (126 hosts can be on this network)