Table of contents
1.
Introduction
2.
What is an IP Address?
3.
IP Address Classes
4.
How does an IP address work?
5.
Use Cases and Examples
6.
Subnetting and CIDR
7.
Special IP Addresses and Reserved Ranges
8.
IPv6 Address Classes and Scope
9.
Limitations of classful IP addressing
10.
Frequently Asked Questions
10.1.
How can I determine the class of an IP address?
10.2.
What is the role of subnet masks in IP address classes?
10.3.
Can I use Class D and Class E IP addresses for my network?
11.
Conclusion
Last Updated: Mar 27, 2024
Easy

IP Address Classes

Author Rashmi
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

An IP(Internet Protocol) address is a unique identifier assigned to devices on a network. IP addresses are essential for communication between devices and are divided into classes to ensure efficient allocation and organization.

IP Address Classes

 In this article, we'll explore the different IP address classes, their characteristics, and their uses, along with frequently asked questions related to the topic.

What is an IP Address?

An IP (Internet Protocol) address is a numerical label assigned to devices on a network, facilitating communication and data exchange. 

There are two IP address versions currently in use: IPv4 and IPv6.

  1. IPv4: The most commonly used version, IPv4 addresses are 32-bit numbers, typically represented in a dotted-decimal format (e.g., 192.168.1.1).
  2. IPv6: Introduced to overcome the limitations of IPv4, IPv6 addresses are 128-bit numbers, represented in a hexadecimal format (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).
     

In this article, we'll focus on IPv4 address classes.

IP Address Classes

IPv4 addresses are divided into five classes: A, B, C, D, and E. These classes were designed to accommodate different network sizes and use cases.

  1. Class A: Large networks with a vast number of devices. The first 8 bits represent the network, and the remaining 24 bits are for host addresses.
     
  2. Class B: Medium-sized networks. The first 16 bits represent the network, and the remaining 16 bits are for host addresses.
     
  3. Class C: Small networks. The first 24 bits represent the network, and the remaining 8 bits are for host addresses.
     
  4. Class D: Used for multicast addressing, which allows a single data packet to be transmitted to multiple devices simultaneously.
     
  5. Class E: Reserved for experimental purposes and future use.

Class

Range

Default Subnet Mask

Network Bits

Host Bits

Networks

Hosts per Network

Use Case

A 1.0.0.1 - 126.255.255.254 255.0.0.0 8 24 126 16,777,214 Large networks
B 128.1.0.1 - 191.255.255.254 255.255.0.0 16 16 16,384 65,534 Medium-sized networks
C 192.0.1.1 - 223.255.254.254 255.255.255.0 24 8 2,097,152 254 Small networks
D 224.0.0.0 - 239.255.255.255 N/A N/A N/A N/A N/A Multicast addressing
E 240.0.0.0 - 255.255.255.254 N/A N/A N/A N/A N/A Experimental purposes

How does an IP address work?

The working of an IP address follows a set of rules to send information. Using these rules and protocols, we can send, and receive data to and from the connected devices. The steps are as follows:

  • First, your device requests the Internet Service Provider for access to the web, which it further grants.
     
  • Second, an IP address is assigned to your device from the given available range.
     
  • Third, your internet activity goes via the service provider, and they route it to you using the IP address you got.
     
  • Then, furthermore, your IP address can change. For example, if you turn off and on your router, your IP address can change. It also changes if you change the network of your device.

Use Cases and Examples

Some use cases with examples of IP address classes are:-

  • Class A: Large enterprises, government organizations, and ISPs typically use Class A IP addresses to accommodate a vast number of devices.
    Example: IP address 10.35.67.129 belongs to Class A, with a default Subnet mask of 255.0.0.0.
     
  • Class B: Universities, large schools, and mid-sized companies often use Class B IP addresses.
    Example: IP address 172.16.12.34 belongs to Class B, with a default subnet mask of 255.255.0.0.
     
  • Class C: Small businesses, home networks, and small organizations generally use Class C IP addresses.
    Example: IP address 192.168.1.15 belongs to Class C, with a default subnet mask of 255.255.255.0.
     
  • Class D: Class D IP addresses are used for multicast addressing in applications such as video conferencing and IPTV.
    Example: IP address 233.10.20.30 belongs to Class D.

Subnetting and CIDR

As the demand for IP addresses grew, the original IP address class system proved insufficient. Subnetting and Classless Inter-Domain Routing (CIDR) were introduced to improve IP address allocation efficiency.

Subnetting involves dividing a network into smaller subnetworks, allowing for better organization and control. CIDR, on the other hand, enables the allocation of IP addresses using variable-length subnet masks, eliminating the rigid structure of the class-based system. This approach allows for more efficient use of the IPv4 address space.

Special IP Addresses and Reserved Ranges

There are certain IP addresses and ranges reserved for specific purposes, such as private networks, loopback addresses, and link-local addresses.

  • Private IP addresses: These addresses are reserved for use within private networks and are not routable on the public internet. The reserved ranges are 10.0.0.0 - 10.255.255.255 (Class A), 172.16.0.0 - 172.31.255.255 (Class B), and 192.168.0.0 - 192.168.255.255 (Class C).
     
  • Loopback addresses: IP addresses in the range of 127.0.0.0 - 127.255.255.255 are reserved for loopback testing, with 127.0.0.1 being the most commonly used.
     
  • Link-local addresses: The range 169.254.0.0 - 169.254.255.255 is reserved for link-local addressing, which is used when a device cannot obtain a valid IP address from a DHCP server.

IPv6 Address Classes and Scope

While IPv6 does not have traditional address classes like IPv4, it does have different address scopes that serve similar purposes. IPv6 addresses are classified by their scope, which determines their reachability:

IPv6 Address Classes and Scope

Global Unicast Addresses: These are globally routable addresses, much like public IPv4 addresses.

  • Unique Local Addresses: Similar to private IPv4 addresses, these are reserved for use within local networks and are not routable on the public internet.
     
  • Link-Local Addresses: These addresses are used for communication within the same network segment and are not routable beyond it.
     
  • Multicast Addresses: IPv6 multicast addresses are used to send data to multiple devices simultaneously, similar to IPv4 Class D addresses.
     
  • Anycast Addresses: Anycast addresses are assigned to multiple devices, allowing a single address to represent multiple network nodes. Data sent to an anycast address is delivered to the nearest node based on routing criteria.

Limitations of classful IP addressing

Let us note down some limitations of classful IP addressing as follows:

  • There are fixed blocks of allocated addresses for each class. For example, Class B can support 16,384 networks and 65,536 addresses per network, making it a total of 1,07,37,25,440 networks. But what if someone wants just 200,000 networks and opts for Class B addressing? Then even unwillingly, he/she is wasting addresses allotted to him/her.
     
  • Classful addressing does not support subnetting. Subnetting enables better IP address utilization and management.
     
  • It requires routers for the maintenance of large routing tables. This increased the complexity and reduced the efficiency.
     
  • All bits as 0 and 1 cannot be used as they are fixed for IP broadcast address and a specific host respectively.

Frequently Asked Questions

How can I determine the class of an IP address?

Examine the first octet of the IP address. Each class has a specific range of first octet values (e.g., 1-126 for Class A, 128-191 for Class B).

What is the role of subnet masks in IP address classes?

Subnet masks are used to separate the network and host portions of an IP address, allowing for efficient routing and organization within a network.

Can I use Class D and Class E IP addresses for my network?

Class D addresses are reserved for multicast addressing, while Class E addresses are reserved for experimental purposes. They should not be used for regular network configurations.

Conclusion

Understanding IP address classes is essential for managing and organizing networks effectively. IP address classes A, B, and C cater to networks of varying sizes, while Class D addresses are used for multicast addressing, and Class E is reserved for experimental purposes.

Recommended Reading:

1. IPv4

2. Network Addressing


You can refer to our guided paths on the Coding Ninjas Studio platform. You can check our course to learn more about DSADBMSCompetitive ProgrammingPythonJavaJavaScript, etc. 

To practice and improve yourself in the interview, you can also check out Top 100 SQL problemsInterview experienceCoding interview questions, and the Ultimate guide path for interviews

Happy Learning!!

Live masterclass