Classless Inter-Domain Routing and Subnetting

Learn about Classless Inter-Domain Routing (CIDR) and concepts of subnetting.

After learning about classful addressing, we know how the IP address blocks have been organized into different ranges within classes, each with a different number of IP addresses. Is it scalable and sustainable to assign IP addresses using classful addressing? Assume we require 400 IP addresses for our office network; which class of IP range should we choose to meet our needs?

We can’t use class C because it only allows for 256 IP addresses in a network; our other options are class A (16777216 IPs) or class B (65536 IPs). Class B appears to be a better option, but it would still be a waste of 65136 (65536 - 400) IP addresses.

This is why traditional classful addressing was not scalable or sustainable, resulting in inefficient routing and address allocation. To address this issue, Classless Inter-Domain Routing (CIDR) was introduced as an extension to classful addressing in 1993. Before diving into CIDR, let’s look at some important concepts.

Subnet mask

In classful addressing, we learned how different classes have different numbers of bits or octets defined as network and host parts. Looking at an IP address using classful addressing, it becomes easy to identify the network block and host block of an IP address. For example, 192.168.12.18 belongs to class C, with the first 24 bits (3 octets) 192.168.12 as the network part and the last 8 bits—18—as the host part.

The assignment of bits as a network part can also be specified using an alternative representation known as the subnet mask. In a subnet mask, the bits that are part of the network are represented by 1’s, and the remaining bits are all represented by 0’s.

The subnet mask of IP 192.168.12.18 is 11111111.11111111.11111111.00000000, which can be rewritten as 255.255.255.0 in dotted decimal, also known as the default subnet mask of class C.

Routers use subnet masks to determine the host’s network and route the data packets to the correct network.

Classless Inter-Domain Routing (CIDR)

The restriction of network range being limited to class A, B, and C networks was removed in Classless Inter-Domain Routing (CIDR) by introducing the concept of Variable Length Subnet Masking (VLSM). Instead of being limited to 8, 16, or 24 bits as network parts, CIDR now allows users to choose any length of available network bits based on their needs.

This makes it possible to select a network block with as many hosts/IPs as necessary, thereby preventing IP address underutilization.

CIDR notation

The IP address representation known as CIDR notation includes the number of selected network part bits following the IP of the network address block, both separated by a forward slash.

Let’s understand CIDR notation with the help of a few examples:

  • In CIDR notation 192.168.12.0/24, /24 represents the number of network bits, which means the given address block contains 232-24 or 256 hosts or IP addresses.

  • In CIDR notation 192.168.12.18/23, /23 represents the number of network bits, which means the given address block contains 232-23 or 512 hosts or IP addresses.

  • In CIDR notation 192.168.12.18/32, /32 represents the number of network bits, which means the given address block contains 232-32 or 1 host or IP address. The /32 CIDR represents a single IP address.

  • All IPv4 addresses, or any IP from the IPv4 address space, are represented by the CIDR notation 0.0.0.0/0.

By entering the number of network bits under the “Number of network bits” field, the number of hosts present in a specific CIDR block can be determined using the Number of Hosts Calculator provided below.

Get hands-on with 1200+ tech skills courses.