An IP address is a 32 bits unique binary number used to identify networks and devices or hosts, the result of the conversion of the binary number to decimal is what we know as IP address.
In decimal format this address consists of 4 numbers ranging from 0 to 255 separated by a dot. For example: 240.34.87.22 is an IP address (in binary format: 11110000.00100010.01010111.00010110).
Each one of those numbers separated by dots is called octet. In the previous example 240 is an octet, 34 is another octet, 87 the third octet and 22 the fourth octet. Each octet consists of 8 bits. Some bits are used to identify a network, while the rest are used to identify hosts within a network.
Formerly, IP addresses were classified by classes which were used to define octet bits, the octets belonging to the network and octets belonging to hosts.
There are 5 IP address classes, each one defined by a letter: A, B, C, D and E and classified depending on the first octet range.
For example, the A class includes all IP addresses from 0.0.0.0 to 127.255.255.255, therefore an IP address whose first octet is between 0 and 127 is an A class IP address.
The table below shows each IP class ranges.
IP ADDRESS CLASS | IP RANGE START | IP RANGE END |
---|---|---|
A | 0.0.0.0 | 127.255.255.255 |
B | 128.0.0.0 | 191.255.255.255 |
C | 192.0.0.0 | 223.255.255.255 |
D | 224.0.0.0 | 239.255.255.255 |
E | 240.0.0.0 | 255.255.255.255 |
Thus, for example the IP address 122.34.56.22 is an A class IP address because the first octet (122) is between 0 and 127. The IP 150.45.22.5 is a B class IP address because the first octet is between 128 and 191. 192.168.0.1 is a C class IP address, 226.33.44.22 belongs to the D class and 245.65.22.15 is an E class IP address.
Usually, only A, B and C classes are implemented while D class is for multicast and the E class is for experimental use.
Note: It is important to clarify IP addresses starting with 127 are considered as loopback.
A Class IP Addresses
In IP addresses belonging to the A class, the first octet identifies the network and the other 3 octets identify as hosts. As said previously, this class of IP addresses consists of a first octet between 0 and 127. In binary format, the A class IP address first bit must be 0. The A class was implemented for big networks, supporting 16 million hosts on each of 127 networks. The following table shows a class A IP address including the binary format. The first octet marked with blue identifies the network while the rest are used for host identification.
122 | 34 | 56 | 22 |
01111010 | 00100010 | 00111000 | 00010110 |
NETWORK | HOST | HOST | HOST |
---|
B Class IP Addresses
B class IP addresses use two first octets to identify the network and last two octets to identify hosts. As said previously, B class IP addresses consist of a first octet between 128.0.0.0 and 191.255.255.255. In binary format of a B class IP address, the first bit must be 1 and the second 0 as shown in the following table. The B class was used for medium size networks, supporting 65.000 hosts on each of 16.000 networks.
150 | 45 | 22 | 5 |
10010110 | 00101101 | 00010110 | 00000101 |
NETWORK | NETWORK | HOST | HOST |
---|
C Class IP Addresses
C class IP addresses use the first 3 octets to identify the network and the last one to identify hosts. As said previously, C class IP addresses consist of a first octet between 192 and 223. In binary format, C class addresses have first two bits 1 and the third bit is 0 as shown in the image below. This class supports up to 254 hosts on each of 2 million networks.
192 | 168 | 1 | 54 |
11000000 | 01000100 | 00000001 | 00110110 |
NETWORK | NETWORK | NETWORK | HOST |
---|
D Class IP Addresses
Contrary to previous classes, the D class isn’t used to identify hosts but host groups or multicast groups. As explained previously, D class IP addresses consist of a first octet between 224 and 239. In binary format, D class IP addresses have first 3 bits 1, and the fourth bit 0.
E Class IP Addresses
E class IP addresses are used for experimental or research purposes. This IP address class includes the first octet range between 240 and 255. In binary format, the first 4 bits of an E class IP address are 1.
Conclusion
First of all, it is important to clarify to readers that the IP address classes classification is deprecated. Yet, computer science students are required to understand this old standard for networking, which seems confusing but as you can see is very simple. Another important clarification is IP address classes were applied only to the IPv4 protocol without including the IPv6 protocol.
In 1993, the IP address classes method was replaced by Classless Inter-Domain Routing (CIDR) allowing a more efficient IPv4 addresses use. Instead of using octets to classify IP addresses, CIDR uses the VLSM (variable length subnet mask) method, specifying network bits with a prefix at the end of the IP address.
For example, a B class IP address may be expressed as 192.168.0.3/16, where /16 defines the number of bits belonging to the network (first two octets) while the rest of bits belong to hosts. A C class address may be expressed as 220.43.56.7/24, where 24 defines the number of bits to identify networks (since each octet is eight bits size, the three first octets are 24 bits).
I hope this tutorial was useful. Keep following Linux Hint for more Linux tips and tutorials.