Classful vs. Classless Addressing in IPv4: Understanding IP Address Allocation

Compare and contrast classful and classless (CIDR) addressing in IPv4. This guide explains the limitations of classful addressing, the advantages of CIDR's variable-length subnet masks, and how CIDR notation improves IP address allocation efficiency.



Classful vs. Classless Addressing in IPv4

Introduction to IPv4 Addressing

Every device on an IP network needs a unique IP (Internet Protocol) address for communication. IPv4 (Internet Protocol version 4) uses 32-bit addresses. These addresses are hierarchical, meaning they are divided into two parts: a network portion (identifying the network) and a host portion (identifying the specific device on that network).

Classful Addressing

Early IPv4 addressing used a system called classful addressing. This divided the 32-bit address into five classes (A, B, C, D, E), each with a fixed-length network prefix. The class was determined by the starting bits of the IP address.

Classful Address Classes:

Class Address Range Network Bits Host Bits Number of Networks Hosts per Network
A 0.0.0.0 - 127.255.255.255 8 24 128 16,777,214
B 128.0.0.0 - 191.255.255.255 16 16 16,384 65,534
C 192.0.0.0 - 223.255.255.255 24 8 2,097,152 254
D (Multicast) 224.0.0.0 - 239.255.255.255 - - - -
E (Reserved) 240.0.0.0 - 255.255.255.255 - - - -

Classless Addressing (CIDR)

Classful addressing proved inefficient, leading to significant IP address wastage. Classless addressing (CIDR - Classless Inter-Domain Routing) was developed to address this. CIDR allows for variable-length subnet masks, providing more flexibility in allocating IP addresses and improving efficiency.

CIDR Notation:

CIDR uses slash notation (e.g., 192.168.1.0/24). The number after the slash indicates the number of bits used for the network portion of the address. The remaining bits are for the host portion.

Example:

The address 167.199.170.82/27 has 2(32-27) = 32 addresses. The first address is found by setting the last 5 bits to 0, and the last address is found by setting them to 1.

Classful vs. Classless Addressing: A Comparison

Feature Classful Addressing Classless Addressing (CIDR)
Network Size Fixed Variable
Prefix Length Fixed (8, 16, 24) Variable (0-32)
Efficiency Inefficient (address wastage) More efficient
Subnetting Less flexible Highly flexible
Current Use Obsolete Current standard

Conclusion

Classless addressing (CIDR) has replaced classful addressing as the standard for IPv4 because it's more flexible and efficient. CIDR's variable-length subnet masking allows for better utilization of IP addresses and simplifies network planning and management.