• edited by
22,211 views
53 53 votes

Consider the following routing table at an IP router:
$$\begin{array}{|l|l|l|} \hline \textbf {Network No} & \textbf {Net Mask} & \textbf{Next Hop}  \\\hline \text {128.96.170.0} &  \text{255.255.254.0} & \text{Interface $0$} \\\hline\text {128.96.168.0} &  \text{255.255.254.0} & \text{Interface $1$} \\\hline\text {128.96.166.0} &  \text{255.255.254.0} & \text{R$2$}\\\hline \text {128.96.164.0} &  \text{255.255.252.0} & \text{R$3$}\\\hline \text {0.0.0.0} &  \text{Default} & \text{R$4$}\\\hline \end{array}$$
For each IP address in Group I Identify the correct choice of the next hop from Group II using the entries from the routing table above.
$$\begin{array}{|ll|ll|} \hline & \textbf {Group I} &  \textbf {Group II}  \\\hline
&\text{i)   128.96.171.92} &  \text{a) Interface 0} \\ \hline
&\text{ii)  128.96.167.151} &  \text{b) Interface 1} \\\hline
&\text{iii) 128.96.163.151} & \text{c) R$2$}\\ \hline
&\text{iv) 128.96.164.121} & \text{d) R$3$}\\ \hline
&\text {} & \text{e) R$4$}\\\hline \end{array}$$

  1. $\text{i-a, ii-c, iii-e, iv-d}$
  2. $\text{i-a, ii-d, iii-b, iv-e}$
  3. $\text{i-b, ii-c, iii-d, iv-e}$
  4. $\text{i-b, ii-c, iii-e, iv-d}$

9 Answers

Best answer
49 49 votes

Taking the 1st IP Address: 128.96.171.92

Bitwise AND between $128.96.171.92$ and $255.255.254.0$ we get the subnet ID as follows:$$ \begin{array} {rrrr}255&255&11111110&0 \\ 128&96&10101011&92 \\ \hline \textbf{128}&\textbf{96}&\textbf{10101010}&\textbf{0}\end{array}$$

∴ Subnet ID = 128.96.170.0
∴ 128.96.171.92 will forward to interface 0


Taking the 2nd IP Address: 128.96.167.151

Bitwise AND between $128.96.167.151$ and $255.255.254.0$ we get, $$ \begin{array} {rrrr}255&255&11111110&0 \\ 128&96&10100111&151 \\ \hline \textbf{128}&\textbf{96}&\textbf{10100110}&\textbf{0}\end{array}$$

∴ Subnet ID = 128.96.166.0
∴ 128.96.167.151 will forward to interface R2


Taking the 3rd IP Address: 128.96.163.151

Bitwise AND between $128.96.163.151$ and $255.255.254.0$ we get, $$ \begin{array} {rrrr}255&255&11111110&0 \\ 128&96&10100011&151 \\ \hline \textbf{128}&\textbf{96}&\textbf{10100010}&\textbf{0}\end{array}$$

∴ Subnet ID = 128.96.162.0 (Doesn’t match with any given interface)

Now, Bitwise AND between $128.96.167.151$ and $255.255.252.0$ we get, $$ \begin{array} {rrrr}255&255&11111100&0 \\ 128&96&10100011&151 \\ \hline \textbf{128}&\textbf{96}&\textbf{10100000}&\textbf{0}\end{array}$$

∴ Subnet ID = 128.96.160.0 (Doesn’t match with any given interface)
∴ 128.96.163.151 will forward to default interface R4


Taking the last IP Address: 128.96.164.121

Bitwise AND between $128.96.164.121$ and $255.255.254.0$ we get, $$ \begin{array} {rrrr}255&255&11111110&0 \\ 128&96&10100100&121 \\ \hline \textbf{128}&\textbf{96}&\textbf{10100100}&\textbf{0}\end{array}$$

∴ Subnet ID = 128.96.164.0
∴ 128.96.167.151 will forward to interface R3

∴ Option (A) is the correct answer.

• edited by
21 21 votes
Option $A$ is correct . Do the $AND$ operation of group $1$ with net mask you will get the answer.
• edited by
6 6 votes
i) 128.96.171.92  --- > First addr 128.96.170.0         a) Interface 0

ii) 128.96.167.151 ---> First  addr 128.96.166.0        c) R2

iii) 128.96.163.151--> first addr matches none e) R4

iv) 128.96.164.121---> first addr  128.96.164.0       d) R3

               

Consider the following routing table at an IP router:

 

Network No                      Net Mask            Next Hop

128.96.170.0/23 255.255.254.0     Interface 0

128.96.168.0/23 255.255.254.0     Interface 1

128.96.166.0/23 255.255.254.0     R2

128.96.164.0/22 255.255.252.0     R3

0.0.0.0   Default R4

 

128.96.171.92

To get First Net addr make the last 32-N bits of the addr to zero.[N is prefix]

First prefix to check is 23 --> 32-23=9

Make the last 9 bits of the addr to zero. The last 9 bits of address are in the last two octets.

171.92 -  - - - - -> 170.0   hence first netaddress is 128.96.170.0 matches first entry.
2 2 votes

This simple concept of Bitwise ending Network Mask and IP address gives us network ID is being asked in GATE numerous times.

In question we are given with the network id and subnet mask. we are asked that which of the following IP addres belongs to which network?

 

As it is Classless

just look at third octet as the starting two octets are same in all options.

Approach:

Write the binary for 

163 - 10100011 matches with nothing so it will go through default 0.0.0.0

165 - 10100101   matches with    164 - 10100100              255.255.252.0

167 - 10100111   matches with    166 - 10100110              255.255.254.0

171 - 10101011   matches with    170 - 10101010              255.255.254.0


 

 

So option A is correct

 

 

 

 

1 1 vote

 

Ans :A
I have a shortcut to solve this type of question because if you use each ip and try to and it with all subnet mask and then find the interface and then get the correct answer it will take you around 3min +
The shortcut is
:
in 20 sec see the options 


i-> a  or i->b so check with subnet mask given in a and b it will take aroud 30 sec (if you are fast enough)

now pick subnet mask for ii or iv    (if you pick iii then you have to check 3 subnet mask)
so we pick ii and we got our correct option. To cross verify check only for iv of A option .

Answer:
Position:
Show:

Related questions

39 39 votes
6 answers 6 answers
15.5k
15.5k views
go_editor asked Feb 12, 2015
15,492 views
Identify the correct order in which a server process must invoke the function calls accept, bind, listen, and recv according to UNIX socket API.$\textsf{listen, accept, b...
60 60 votes
5 answers 5 answers
23.9k
23.9k views
go_editor asked Feb 13, 2015
23,868 views
In a connected graph, a bridge is an edge whose removal disconnects the graph. Which one of the following statements is true?A tree has no bridgesA bridge cannot be part ...
80 80 votes
5 answers 5 answers
28.8k
28.8k views
go_editor asked Feb 12, 2015
28,811 views
Consider a processor with byte-addressable memory. Assume that all registers, including program counter (PC) and Program Status Word (PSW), are size of two bytes. A stack...
53 53 votes
4 answers 4 answers
18.2k
18.2k views
go_editor asked Feb 12, 2015
18,240 views
Consider the C program below#include <stdio.h int *A, stkTop; int stkFunc (int opcode, int val) { static int size=0, stkTop=0; switch (opcode) { case -1: size = val; brea...