retagged by
9,057 views
20 votes
20 votes

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?

  1. M, N, and P all belong to the same subnet
  2. Only M and N belong to the same subnet
  3. Only N and P belong to the same subnet
  4. M, N, and P belong to three different subnets
retagged by

4 Answers

Best answer
26 votes
26 votes
First derive the network address of those machines, then we can decide !

Finding network address for a M/C :- Perform Bitwise AND between m/c address and given subnet mask.

Subnet Mask: keep $1$'s in Network part $+$ subnet part and keep $0$'s in Host part.

$255.255.255.252 = 11111111.11111111.11111111.11111100$
$ \implies 24( \text{from first 3 octets} ) + 6 ( \text{ in last octet })$
$\quad = 30 \text{bits in Network+ subnet portion and last 2 bits represent the Host part}.$

Subnet Mask $= 255.255.255.252$ and $M = 100.10.5.2$ but keep all zero's in HOST part !

$\begin{array}{|l|l|l|l|} \hline  100 = 01100100 & 10 =  00001010 & 5   =  00000101 & 2    = 000000 \color{red}{00} \\ \hline 255 = 11111111 & 255 = 11111111 & 255 = 11111111 & 252 = 11111100 \\ \hline 100 & 10 & 5 & 0 \\ \hline \end{array}$

Subnet Mask $= 255.255.255.252$ and $N = 100.10.5.5$ but keep all zero's in HOST part !

$\begin{array}{|l|l|l|l|} \hline 100 = 01100100 & 10 =  00001010 & 5   =  00000101 & 5    = 000001 \color{red}{00} \\ \hline 255 = 11111111 & 255 = 11111111 & 255 = 11111111 & 252 = 11111100 \\ \hline 100 & 10 & 5 & 4 \\ \hline \end{array}$

Subnet Mask $= 255.255.255.252 $ and $P = 100.10.5.6 $ but keep all zero's in HOST part !

$\begin{array}{|l|l|l|l|} \hline 100 = 01100100 & 10 =  00001010 & 5   =  00000101 & 6    = 000001\color{red}{00} \\ \hline 255 = 11111111 & 255 = 11111111 & 255 = 11111111 & 252 = 11111100 \\ \hline 100 & 10 & 5 & 4 \\ \hline \end{array}$

$\therefore$ only $N$ and $P$ are belong to same network $(100.10.5.4/30) $
edited by
4 votes
4 votes
M: 100.10.5.2 , N: 100.10.5.5 , p: 100.10.5.6

SM =  255.255.255.252 = 255.255.255.11111100 (only express Last byte into binary form bcz first 3 byte already all 1)

Now Bitwise end of each IP addresses (M,N,P) with SM . It will give us Subnet id (SID) of each Machine.

for M it SID gives : 100.10.5.0

for N it SID gives : 100.10.5.4

for P it SID gives : 100.10.5.4

So, we can say that SID of N is same as SID of P . So  N,P belongs to the same subnet

And subnet is : (100.10.5.4/30)
edited by
3 votes
3 votes

This is what I think:

Firstly, the technique is, do bitwise AND with subnet- the network ids given, those who return the same values are in the same subnet.

The parts of the subnet which are 255 will spit out what we give them, they are all 1's so we already know first three octets after multiplication for all three network IDs. They will be the same.

The last octet of the subnet, 252 only matters. Break it to get the binary - 128+64+32+16+8+4 = 11111100. Doing bitwise AND with this binary number will spit out same nos till 6th-bit rest will be eaten by 0's.

The last octets of net ids are -  2-> 000000'10,     5-> 000001'01,      6-> 000001'10  (The ' symbol shows how far the bits survive)

So for 5 and 6 same bit pattern survives, basically, ANDing 252 with 2 gives 0, with 5 gives 4, with 6 gives 4.

As 5 and 6 return same values, they are in the same subnet.

 

2 votes
2 votes
Answer c  N and P
This types of question already asked in 2003
If two host belong to same network then their subnet id should be same . Subnet id can be obtained using subnet mask .Take a IP address of a host and perform Bitwise AND operation with subnet mask results subnet id.
Subnet mask : 255.255.255.254
Ip address of M IPm: 194.56.10.2
Ip address of N IPn : 194.56.10.5
Ip address of P IPp: 194.56.10.6
Subnet id of M sidm = SM        11111111.11111111.11111111.11111100                                                                                        Bitwise AND                                                                                                                                                                                        IPm                                           11000010.00111000.00001010.00000010                                                                        ____________________________________________________________________
                                         =      11000010.00111000.00001010.00000000
                                          =     194.56.10.0
 
Subnet id of N= SM             11111111.11111111.11111111.11111100                                                                                             Bitwise AND                                                                                                                                                                                                          IPn                   11000010.00111000.00001010.00000101                     ___________________________________________________________________                                                                                                              = 11000010.00111000.00001010.0000.100                                                                                                                                       =194.56.10.4
 
Subnet id of P= SM             11111111.11111111.11111111.11111100                                                                                              Bitwise AND                                                                                                                                                                                                     IPp                          11000010.00111000.00001010.00000110               __________________________________________________________________________ .                                                                                             = 11000010.00111000.00001010.00000100
                                         = 194.56.10.4
    Sid of N = Sid of P
     Hence N and P are host of same network 
 
 
Answer:

Related questions

26 votes
26 votes
6 answers
2
Arjun asked Feb 7, 2019
19,665 views
Consider that $15$ machines need to be connected in a LAN using $8$-port Ethernet switches. Assume that these switches do not have any separate uplink ports. The minimum ...
13 votes
13 votes
6 answers
3