Q. Consider three machines M, N, and P with IP addresses 100.10.5.2, 100.10.5.5, and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true? |
(A) M, N, and P all belong to the same subnet |
(B) Only M and N belong to the same subnet |
(C) Only N and P belong to the same subnet |
(D) M, N, and P belong to three different subnets |
Solution:
First, we will do bitwise AND between Subnet mask and given IP address one by one
For M: 100.10.5.2
Bitwise AND:
01100100.00001010.00000101.00000010 (100.10.5.2)
AND 11111111.11111111.11111111.11111100 (255.255.255.252)
___________________________________________________________
= 01100100.00001010.00000101.00000000 (100.10.5.0)
For N: 100.10.5.5
Bitwise AND:
01100100.00001010.00000101.00000101 (100.10.5.5)
AND 11111111.11111111.11111111.11111100 (255.255.255.252)
___________________________________________________________
= 01100100.00001010.00000101.00000100 (100.10.5.4)
For P: 100.10.5.2
Bitwise AND:
01100100.00001010.00000101.00000110 (100.10.5.6)
AND 11111111.11111111.11111111.11111100 (255.255.255.252)
___________________________________________________________
= 01100100.00001010.00000101.00000100 (100.10.5.4)
It is sure from the above computation that N and P belong to the same network (i.e., 100.10.5.4), while M can belong to the same network or it can be from any other network.