IP Address Classes Explained with Examples
This tutorial explains IP address classes in detail through examples. Learn how IP addresses are organized in IP classes and how to identify the class of an IP address.
There are two versions of IP addresses, IPv4 and IPv6. In this tutorial, we will discuss how IPv4 organizes IP addresses. In IPv4, there are 4,294,967,296 IP addresses. These addresses are organized into five IP classes. These classes are A, B, C, D, and F.
Before we understand how IP addresses are organized in these classes, let's briefly discuss how IP addresses are written and structured.
IP addresses notation
Computers understand only the binary system. The binary system uses bits to store and process data. A bit can store only two values: zero (0) and one (1). If the value 'zero' is stored, the bit is known as the OFF bit. If the value 'one' is stored, the bit is known as ON bit. The binary system uses a unique combination of ON and OFF bits for each letter and number.
Using IP addresses in the binary format is not easy. But the good news is that unless you are a software developer or a network administrator, you never need to write and use IP addresses in binary notation. You can write and use them in decimal format. The software program that you use to assign the IP address on the interface automatically converts the assigned IP address into binary format.
If you are a software developer or a network administrator, you can also use IP addresses in decimal format. But you should also understand how IP addresses work in the binary system. Since interfaces use the binary system to process IP addresses, learning IP addresses in binary format can make your IP related tasks easy.
In short, you can write and use IP addresses in two notations: binary notation and decimal-dotted notation. In binary notation, all the individual bits of each byte are expressed as a binary number. In decimal notation, all four binary bytes are converted and expressed to their decimal equivalent numbers.
In this tutorial, we will understand IP classes in both notations.
IP addresses structure
An IP address consists of 32 bits. These bits are divided into four sections. Sections are separated by a dot (.). Each section contains 8 bits. 8 bits are equal to 1 byte or 1 octet. The following image shows how bits are organized in an IP address.
By using 32 bits with two possible values for each position, the binary system can create 4,294,967,296 (232) unique combinations or IP addresses. These addresses can be used without any addressing scheme or with an addressing scheme that arranges them in such a way that it becomes easier to access them.
If addresses are used without any addressing scheme, all routers on the network will need to store the address of each and every interface on the network. Depending on the size of the network, this may affect routing. If the network size is small, it can make routing slow. If the network size is moderate, it can make routing very slow. If the network size is large, it can make routing completely impossible.
For efficient routing, addresses are organized into the hierarchical addressing scheme. In this scheme, all addresses are divided into five classes and each address is divided into two addresses: the network address and the host address.
IP address classes
Based on the following rules, IP addresses are categorized into five classes; A, B, C, D, and E.
- In class A, the first bit of the first byte always remains OFF (0).
- In class B, the first bit of the first byte always remains ON and the second bit of the first byte always remains OFF.
- In class C, the first two bits of the first byte always remain ON and the third bit of the first byte always remains OFF.
- In class D, the first three bits of the first byte always remain ON and the fourth bit of the first byte always remains OFF.
- In class E, the first four bits of the first byte always remain ON.
By turning all remaining bits of the first byte ON and OFF, we can make the first and last address of that class.
The following table lists the value of the first byte or octet in both notations.
|Class||Fix bits||First address (binary notation)||Last address (binary notation)||First address (decimal notation)||Last address (decimal notation)|
Network and host addressing
In the second level of the hierarchical addressing scheme, each address is further divided into two addresses: the network address and host address.
Network addresses are used to combine multiple IP addresses in a group while host addresses are used to provide a unique identity to each IP address in the group. A network address is the group address. All group members use the same network address. A host address is a unique address in the group.
To learn more about how the network addresses and host addresses work, you can check the following tutorial.
The length of network addresses and host addresses in IP addresses are different in all IP classes. In class A, the first bits are reserved for the network address. The remaining 24 bits are available for the host address. In class B, the first 16 bits are reserved for the network address while the last 16 bits are available for the host address. In class C, the first 24 bits are reserved for the network address while the last 8 bits available for the host address.
The following image shows how bits are defined for network addresses and host addresses in each IP class.
In IP addresses, host bits are flexible. Administrators can adjust the length of host bits to meet the requirements of their networks. They can use host bits as network bits to utilize maximum addresses from all available addresses. If hosts bits are used as the network bits, this is known as the subnetting.
Class D and E are not used for the host addressing. Class D addresses are used for multicast addresses. Class E addresses are reserved for research and development purposes. Multicast addresses are explained in the following tutorial.
The subnet mask
IP addresses use an additional component to distinguish between network addresses and host addresses. This component is known as the subnet mask. In simple words, the subnet mask tells, how many bits in the IP address are used as the network address and how many bits are left for the host address.
IP addresses are always written with the subnet mask. The following table lists the default subnet mask for all IP classes.
|Class||Decimal notation||Binary notation|
|C||255.255.255.0||11111111. 11111111. 11111111.00000000|
Identifying the class of an IP address (decimal notation)
If an IP address is written in the decimal notation, check the value of the first section or octet and use the following rules to identify the class of the IP address.
- If the value is in the range 1 to 127, the address belongs to class A.
- If the value is in the range 128 to 191, the address belongs to class B.
- If the value is in the range 192 to 223, the address belongs to class C.
- If the value is in the range 224 to 239, the address belongs to class D.
- If the value is in the range 240 to 255, the address belongs to class E.
Identifying the class of an IP address (binary notation)
If an IP address is written in the binary notation, you can use the following rules to identify the class of the IP address.
- If the first bit is OFF, the address belongs to class A.
- If the first bit is ON and the second bit is OFF, the address belongs to class B.
- If the first two bits are ON and the third bit is OFF, the address belongs to class C.
- If the first three bits are ON and the fourth bit is OFF, the address belongs to class D.
- If the first four bits are ON, the address belongs to class E.
Examples of IP addresses
Examples of class A IP addresses are the following.
|Decimal notation||Binary notation|
| 01011111.01010110.01001011.00000100 |
Examples of class B IP addresses are the following.
|Decimal notation||Binary notation|
| 10000001.00001100.00100100.00101010 |
Examples of class C IP addresses are the following.
|Decimal notation||Binary notation|
If you like this tutorial, please share it with friends via your favorite social networking sites and subscribe to our YouTube channel.
By ComputerNetworkingNotes Updated on 2021-09-13 21:43:31 IST
- What is Networking Explained with Examples
- Networking Basic Concepts and Fundamentals Explained
- Computer Networking Devices Explained with Function
- Network Cable Types and Specifications
- Differences between Throughput and Bandwidth Explained
- IPv6 Neighbor Discovery Protocol Explained
- Types of User account in Computer Network Explained
- Data Modulation in Computer Networks
- Basic Functions of a Computer Explained