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|
Thus, for example the IP address 184.108.40.206 is an A class IP address because the first octet (122) is between 0 and 127. The IP 220.127.116.11 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, 18.104.22.168 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.
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 22.214.171.124 and 126.96.36.199. 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.
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.
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.
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 188.8.131.52/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.