IP Addressing and CIDR

Last Updated : 4 Feb, 2026

In the vast expanse of the internet, every device requires a unique identifier to communicate with others. This identifier is known as an IP address, and for many years, the prevalent version has been IPv4 (Internet Protocol version 4). IPv4 addresses are 32-bit numbers represented in a dotted-decimal format, such as 192.168.1.100. To effectively manage and distribute these addresses, a system called Classless Inter-Domain Routing (CIDR) was introduced.

IPv4 Address Structure:-

An IPv4 address is divided into four octets, each represented by a decimal number ranging from 0 to 255. These octets are separated by periods, creating a familiar dotted-decimal notation.

Screenshot-01-(1)

IPv4 Address Classes (Classful)

ClassFirst Octet RangeNetwork PortionHost PortionDefault Subnet Mask
Class A1 – 1261st Octet (8 bits)Last 3 Octets (24 bits)255.0.0.0 (/8)
Class B128 – 1911st & 2nd Octets (16 bits)Last 2 Octets (16 bits)255.255.0.0 (/16)
Class C192 – 2231st, 2nd, & 3rd Octets (24 bits)4th Octet (8 bits)255.255.255.0 (/24)
  • Class A was designed for a few massive networks (like early ISPs or government bodies), supporting over 16 million hosts per network.
  • Class B was for medium-to-large organizations, supporting up to 65,534 hosts.
  • Class C was for small local networks, supporting only 254 usable host addresses.

Classless Inter-Domain Routing (CIDR):-

The problem with classful addressing was its rigidity. If an organization needed 300 addresses, they were too big for Class C (254) and had to take a Class B (65,534), wasting over 65,000 addresses.

To solve this, Classless Inter-Domain Routing (CIDR) was introduced in 1993. CIDR ignores these fixed boundaries and uses a Subnet Mask (or prefix length like /24) to define exactly where the network portion ends. This allows the network "boundary" to exist anywhere, even in the middle of an octet.

Example: A /25 network uses 25 bits for the network. This means the network portion takes the first three octets plus the first bit of the fourth octet, leaving only 7 bits (126 usable addresses) for hosts.

Key Features of CIDR

Variable-Length Subnet Masking (VLSM): CIDR allows network administrators to create subnets of varying sizes, rather than being restricted to the rigid class-based addressing scheme. This enables more granular control over address allocation and reduces the waste of IP addresses.

  • Supernetting: CIDR enables the aggregation of multiple subnets into larger blocks, resulting in more efficient routing and reduced routing table entries. This is particularly beneficial for large networks that have multiple smaller subnets.
  • Route Summarization: CIDR facilitates the summarization of routing information, reducing the number of entries in routing tables and improving routing efficiency. This is particularly important for internet backbone routers, which handle a vast amount of traffic.

Benefits of CIDR

  • Improved IP Address Efficiency: CIDR helps to optimize the allocation of IP addresses, reducing the waste of addresses and extending the lifespan of the IPv4 address space.
  • Reduced Routing Table Size: CIDR-based routing tables are smaller and more manageable, simplifying routing operations and improving network performance.
  • Seamless Network Scalability: CIDR-based networks can easily accommodate growth and changes in network topology, ensuring smooth scaling and adaptability.

CIDR Notation:-

CIDR emerged as a more flexible and efficient way to manage IP addresses compared to the older classful addressing scheme. Instead of assigning addresses based on rigid class boundaries, CIDR allows for the creation of subnets, which are smaller divisions within a network. Each subnet has its own unique prefix length, represented by a number following a slash in the CIDR notation. For instance, 192.168.1.0/24 indicates a subnet with a prefix length of 24, meaning that the first 24 bits are dedicated to the network address and the remaining 8 bits are for host addresses. CIDR notation simplifies the representation of subnets and makes it easier to manage and identify different network segments.

Example 1. What is the maximum number of usable host addresses in this subnet and how many network bits are there in this subnet?

Subnet:192.168.1.0/24

Given:-

IP address: 192.168.1.0

Prefix length: 24

Calculation:

Convert the IP address to binary format:

192.168.1.0 = 11000000.10101000.00000001.00000000

Separate the network bits from the host bits based on the prefix length:

Network bits: 11000000.10101000.00000001

Host bits: 00000000

Determine the number of usable host addresses:

2^host bits - 2 = 2^8 - 2 = 254

Result:

The subnet 192.168.1.0/24 has a network address of 192.168.1.0 and a broadcast address of 192.168.1.255. There are 254 usable host addresses in this subnet.

Example 2. What is the maximum number of usable host addresses in this subnet?

Subnet: 192.168.0.0/16

Given:-

IP address: 192.168.1.0

Prefix length: 16

Calculation:

Convert the IP address to binary format:

192.168.0.0 = 11000000.10101000.00000000.00000000

Separate the network bits from the host bits based on the prefix length:

Network bits: 11000000.10101000

Host bits: 00000000.00000000

Determine the number of usable host addresses:

2^host bits - 2 = 2^16 - 2 = 65534

Result:

The subnet 192.168.0.0/16 has a network address of 192.168.0.0 and a broadcast address of 192.168.255.255. There are 65534 usable host addresses in this subnet.


Comment