IP address is the short form for Internet Address. These help to uniquely identify the hosts on the internet. The data which is sent over the network is delivered to the correct host with the help of the IP address.There are two versions of IP addresses available. IPv4 and IPv6. Let us talk about IPv4 now.
IPv4
IPVersion 4 addresses consist of 32 bits(0 through 31) partitioned into four groups of eight bits each. Each of this group is called an octet. It will be very difficult to understand and decipher the IP addresses if they were represented in the binary form and so they are reprsented in decimal form. Four decimal numbers separated by a dot, each standing for one octet. So, for example an IP address would look like this, 206.172.180.100.
- IP address consist of 32 bits.
- Each grouped into 4 groups of eight bits each.
- Each of the eight bits are referred to as octets.
IP addresses are grouped into five classes class A, class B, class C, class D and class E. In order to differentiate between all these classes, we have to observe the first four bits of the first octet of the IP address.
CLASS A:
If the first bit is 0, then the IP address belongs to Class A. Class A addresses begins with a decimal number ranging from 0 to 127.Both 0 and 127 are reserved. So the first octet’s bit representation.
X X X X X X X X X - First octet's bit position
0 X X X X X X X X - Class A address representation
Each X stands for a bit which can be 0 or 1. For class A addresses the first bit would be a zero only.
CLASS B:
If the first two bits are 10, then the IP address belongs to class B. Class B addresses begins with a decimal number ranging from 128 to 191.
X X X X X X X X - First octet's bit position
1 0 X X X X X X - Class B address representation
The lowest class B address would be 1 0 0 0 0 0 0 0. The decimal equivalent of the same is 128. The highest class B address would be 1 0 1 1 1 1 1 1. The decimal equivalent of the same would be 191. That is why the decimal number range is between 128 to 191.
CLASS C:
If the first three bits are 110, then the IP address belongs to class C. Class C addresses begin with a decimal number ranging from 192 to 223.
X X X X X X X X – The first octet’s eight bits
1 1 0 X X X X X - Class C address representation
The lowest class C address would be 1 1 0 0 0 0 0 0. The decimal equivalent of the same is 27+26 = 192. The highest class C address would be 1 1 0 1 1 1 1 1. The decimal equivalent of the same is = 223.
CLASS D:
If the first four bits are 1110, then the address is class D address. Range of values from 224 to 229.
X X X X X X X X – The first octet’s eight bits
1 1 1 0 X X X X – Class D address
The lowest address would be 1 1 1 0 0 0 0 0. Decimal equivalent of the same is 128 + 64 + 32 = 224. Highest class D address would be 1 1 1 0 1 1 1 1. Again decimal equivalent of the same would be 128 + 64 + 32 + 8 + 4 + 2 +1 = 239. Class D addresses are used for multicasting.
CLASS E:
If the first four bits are 1111, then the address is a class E address. Range of decimal numbers ranging from 240 to 255.
X X X X X X X X – The first octet’s eight bits
1 1 1 1 1 1 1 1 – Class E address.
Lowest address = 1 1 1 1 0 0 0 0 = 128 + 64 + 32 + 16 = 240
Highest address = 1 1 1 1 1 1 1 1 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
STEPS TO FIND OUT THE CLASS OF IP ADDRESS
Given a IP address consider only the first octet. The rest of the octets can be of any value. That should not be of a concern in identifying the class of IP address. When we consider the first octet, there are two ways of identifying the class of IP address. One is to remember the decimal range of values for each class.
- Class A - 0 to 127
- Class B - 128 to 191
- Class C - 192 to 223
- Class D - 224 to 239
- Class E - 240 to 255
So if in the first octet the decimal number is given as 200.200.192.55 then the IP address belongs to class C because it falls in that range. But we might forget this sequence of numbers and that will be trouble for us. So, another way of working this out is to remember only the bit values for each of the class addresses.
- Class A - First bit is 0
- Class B - First two bits 1 0
- Class C - First three bits 1 1 0
- Class D - First four bits 1 1 1 0
- Class E - First four bits 1 1 1 1
So, given any IP address convert the first octet's decimal number to the binary equivalent. Look at the first few bits and decide the class of the IP address.
1. In IPv4, the IP address 200.200.200.200 belongs to
(A) Class A
(B) Class B
(C) Class C
(D) Class D
Ans :- C
Explanation:- Consider only the first octet's decimal value. Ignore the rest. The first octet value is 200. Convert the same to binary equivalent. It is 11001000. If the converted bit equivalent has less than 8 bits, then fill its left side with 0's and bring it to a count of 8 bits. The first 3 bits are 110 here and so this IP address belongs to class C address. So the answer is C. This question is from December 2013 - Paper III.
2. In classful addressing, the IP address 190.255.254.254 belongs to
(A) Class A
(B) Class B
(C) Class C
(D) Class D
Ans:- B
Explanation:- Again consider only the first octet. The value there is 190. Convert it into binary equivalent. It is 1011 1110. Look at the first two bits. It is 10. So it is class B address and so the correct answer is B. This question is from June 2013 - Paper II.
3. In classful addressing, the IP address 123.23.156.4 belongs to __________class format.
(a) A
(b) B
(c) C
(d) D
Ans:- A
Explanation:- Consider the first octet. The value is 123. The binary equivalent is 111 1011. There are only 7 bits. Add a zero in the high order bit. 0111 1011. The first bit is 0 and so the class address is A.This question is from December 2012 - Paper III.
4. IP address in class B is given by:
(A) 125.123.123.2
(B) 191.023.21.54
(C) 192.128.32.56
(D) 10.14.12.34
Ans:- B
Explanation:- You should be in a position to explain it on your own by now!!.