Javatpoint Logo
Javatpoint Logo

Classful vs Classless addressing

IPV4 Addresses, Classful Addressing, Classless Addressing, and the difference between Classful and Classless addressing are discussed in this article.

Let's first discuss about IPV4 addresses

IPV4 ADDRESSES

The IP address, often known as the Internet address, is the unique identifier used in the IP layer of the TCP/IP protocol suite to identify each device's connection to the Internet. A host's or router's connection to the Internet is defined by its 32-bit IPv4 address, which is unique and used worldwide. The IP address, not the host or router, is what identifies the connection because it could change if the device is relocated to a different network.

Since each address specifies a single and exclusive connection to the Internet, IPv4 addresses are distinctive. A device has two IPv4 addresses if it has two networks connecting to the Internet through it. Because every host that wishes to connect to the Internet must use the IPv4 addressing scheme, IPv4 addresses are considered universal.

Hierarchy in Addressing

The addressing system is hierarchical in every type of communication network that requires delivery, including phone and postal networks.

Although it is separated into two parts, a 32-bit IPv4 address is also hierarchical. The network is defined by the first component of the address, known as the prefix, and the node is defined by the second component, known as the suffix (connection of a device to the Internet). A 32-bit IPv4 address's prefix and suffix are shown in the given figure. The lengths of the prefix and suffix are n bits and (32 - n) bits, respectively.

Classful vs Classless addressing

Prefixes can have variable or fixed lengths. The IPv4 network identification was initially intended to be a fixed-length prefix. Classful addressing is the term used to describe this outmoded system. The brand-new addressing method, known as classless addressing, makes use of a variable-length network prefix. Prior to focusing on classless addressing, we briefly explore classful addressing.

1. CLASSFUL ADDRESSING

An IPv4 address originally had a fixed-length prefix, but three fixed-length prefixes (n = 8, n = 16, and n = 24) were created in order to support both small and big networks. As shown in the figure below, the entire address space was partitioned into five classes (classes A, B, C, D, and E). Classful addressing is the term used to describe this system. Despite being a thing of the past, classful addressing aids in the comprehension of classless addressing, which is covered in the later section.

Classful vs Classless addressing

CLASS A - Despite the fact that the network length is 8 bits, we can only use seven bits for the network identifier since the first bit, which is 0 and determines the class, is part of the length. This indicates that only 27 = 128 networks can have a class A address globally.

  • Net ID = 8bits long and Host ID = 24 bits long
  • Method to identify class A addresses:
    • The first bit is reserved to 0 in binary
    • Range of the first octet is [0, 127] in dotted decimal
  • Total number of connections in Class A = 231 (2, 14, 74, 83, 648)
  • There are 27 - 2 = 126 networks in the Class A network.
    • There are 2 fewer networks available overall since IP Address 0.0.0.0 is set aside for broadcasting needs. For usage as a loopback address while testing software, the IP address 127.0.0.1 is set aside.
    • Hence, the range of the first octet becomes [1, 126]
  • Total number of Host IDs in Class A = 224 - 2 [1, 67, 77, 214]
    • There are 2 fewer hosts that can be established across all classes due to the two reserved IP addresses, where all of the host ID bits are either zero or one.
    • The Network ID for the network is represented when all of the Host ID bits are set to 0.
    • The Broadcast Address is represented when all of the Host ID bits are set to 1.
  • Organizations needing very large networks, like Indian Railways, employ class A.

CLASS B - Despite the fact that the first two bits of class B's network, which are 10 in binary or we can write it as (10)2, determine the class, we can only use 14 bits as the network identification, as class B's network length is 16 bits. As a result, only 214 = 16,384 networks in the entire world are capable of using a class B address.

  • Length of Net Id = 16 bits and length of Host ID 16 bits.
  • Method to identify Class B networks:
    • First two bits are reserved to 10 in binary notation
    • The Range of the first octet is [128, 191] in dotted decimal notation
  • Total number of connections in the class B network is 230 = 1, 07, 37, 41, 824
  • Total number of networks available in class B is 214 = 16, 384
  • Total number of hosts that can be configured in Class B = 216 - 2 = 165, 534
  • Organizations needing medium-sized networks typically utilize class B.

CLASS C - All addresses that begin with the number (110)2 fall under class C. Class C networks are 24 bits long, but since the class is defined by three bits, the network identifier can only be 21 bits long. As a result, 221 = 2, 097, 152 networks worldwide are capable of using a class C address.

  • The length of the Net Id and the Host Id = 24 bits and 16 bits respectively.
  • Method to identify Class C networks:
    • First three bits are reserved for 110 in binary notation or (110)2.
    • The range of the first octet is [192, 223] in dotted decimal notation.
  • Total number of connections in Class C = 229 = 53, 68, 70, 912.
  • Total number of networks available in Class C = 224 = 20, 97, 152.
  • Total number of hosts that can be configured in every network in Class C = 28 - 2 = 254.
  • Organizations needing small to medium-sized networks typically choose class C.

Quick Quiz - The maximum number of networks that can use Class C addresses in the IPv4 addressing format is __________

  1. 214
  2. 27
  3. 221
  4. 224

Ans. (c)

CLASS D - Prefix and suffix categories do not exist for Class D. It is employed for multicast addresses.

  • There is no concept of Host ID and Net ID
  • Method to identify Class D network:
    • The first four bits are reserved to 1110 in binary notation or (1110)2
    • The range of the first octet is [224, 239] in dotted decimal notation
  • Total number of IP addresses available is 228 = 26, 84, 35, 456
  • Because data is not intended for a specific host, Class D is set aside for multicasting, which eliminates the requirement to extract the host address from the IP address.

CLASS E - All binary addresses with the prefix 1111 fall under class E. Class E, like Class D, does not have a prefix or a suffix and is used as a reserve.

  • Like in Class D, there is also no concept of Host ID and Net ID.
  • Method to identify Class E networks:
    • The first four bits are reserved to 1111 in binary notation or (1111)
    • The range of the first octet is [240, 255] in dotted decimal notation.
  • Total number of IP addresses available is 228 = 26,84,35,456.
  • Class E is set aside for hypothetical or experimental uses.

2. CLASSLESS ADDRESSING

The address depletion issue was not fully resolved by classful addressing's subnetting and supernetting techniques. As the Internet expanded, it became obvious that a bigger address space was required as a long-term fix. However, the expanded address space necessitates that IP addresses should be longer as well, necessitating a change in IP packet syntax. The short-term solution, which uses the same address space but modifies the distribution of addresses to deliver a fair amount to each business, was developed despite the fact that the long-term solution, known as IPv6, has already been developed. Classless addressing is the temporary fix, which nevertheless makes use of IPv4 addresses. In order to make up for address depletion, the class privilege was taken out of the distribution.

The entire address space is partitioned into blocks of varying lengths with classless addressing. An address's prefix designates the block (network); its suffix designates the node (device). We are capable of having a block of 20, 21, 22 ,..., 232 addresses, theoretically. One of the limitations is that a block of addresses must have a power of two addresses. One address block may be given to an organization. The given figure demonstrates the non-overlapping block segmentation of the entire address space.

Classful vs Classless addressing

In contrast to classful addressing, classless addressing allows for varying prefix lengths. Prefix lengths that vary from 0 to 32 are possible. The length of the prefix has an inverse relationship with network size. A smaller network has a large prefix; a larger one has a small prefix.

We must stress that classful addressing is just as easily adaptable to the concept of classless addressing. Consider an address in class A as a classless address with a prefix length of 8. Class B addresses can be viewed as classless addresses with the prefix 16 and so on. Putting it another way, classless addressing is a specific instance of classful addressing.

Prefix Length - Slash Notation

In classless addressing, the first issue that needs to be resolved is how to determine the prefix length if an address is provided. We must individually provide the prefix length because it is not a property of the address. The address is inserted in this scenario, followed by a slash, and the prefix length, n. Slash notation is the colloquial name for the notation, while classless interdomain routing, or CIDR (pronounced cider) method, is the official name. An address in classless addressing can thus be expressed as illustrated in the figure below.

Classful vs Classless addressing

To put it another way, we must also provide the prefix length in classless addressing because an address does not automatically define the block or network to which it belongs.

Extracting Information from an Address

With respect to any given address in the block, we typically like to know three things: the number of addresses in the block, the start address in the block, and the last address. These three pieces of information, which are depicted in the picture below, are simple to locate because the prefix length, n, is known.

  • The block has N = 232n addresses, according to the calculation.
  • The n leftmost bits are kept, and the (32 - n) rightmost bits are all set to zeroes to determine the first address.
  • The n leftmost bits are kept, while the (32 - n) rightmost bits are all set to 1s to determine the last address.
Classful vs Classless addressing

For Example - The address 167.199.170.82/27 is a classless address. The following is where we can find the aforementioned three pieces of data. In the network, there are 232-n = 25 = 32 addresses in all.

The first 27 bits are kept while the remaining bits are converted to 0s to determine the first address.

Classful vs Classless addressing

Keeping the first 27 bits and turning the remaining bits to 1s will allow you to determine the last address.

Classful vs Classless addressing

Quick Quiz - In the network 200.10.11.144/27, the fourth octet (in decimal) of the last IP address of the network, which can be assigned to a host is _____ (GATE 2015, 2 Marks)

Ans.

Classful vs Classless addressing

Here, the maximum possible value of the last octet is 159 in decimal. Hence, the fourth octet of the last IP address, which can be assigned to a host is 10011110 in binary or 158 in decimal. Hence, the answer to the question is 158.

Difference Between Classful and Classless Addressing

  1. IP addresses are divided into five groups using the classful addressing approach when they are assigned. In order to prevent the depletion of IP addresses, classless addressing is used. It is a method of IP address allocation that will eventually replace classful addressing.
  2. A further distinction is the usefulness of classful and classless addressing. Comparatively speaking, classless addressing is more beneficial and useful than classful addressing.
  3. In classful addressing, the network ID and host ID are adjusted according to the classes. However, the distinction between network ID and host ID does not exist with classless addressing. This opens up the possibility of making yet another contrast between both addressing.

CONCLUSION

IP addressing includes two types: classful and classless. Classless addressing offers a more effective method of allocating IP addresses than classful addressing, which is the main difference between the two. To put it briefly, classless addressing prevents the issue of IP address exhaustion that can occur with classful addressing.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA