18 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}{l|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}$$

- i-a, ii-c, iii-e, iv-d
- i-a, ii-d, iii-b, iv-e
- i-b, ii-c, iii-d, iv-e
- i-b, ii-c, iii-e, iv-d

12 votes

Best answer

**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**

**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**

**Taking the 3rd IP Address: 128.96.163.151**

Bitwise AND between 128.96.167.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)**

**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**

**∴ Option (a) is the correct answer**

19 votes

5 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.

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.

0 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 - **101001**01 matches with **164 - 101001**00 **255.255.252.0**

167 - **1010011**1 matches with **166** - **1010011**0 ** 255.255.254.0**

171 - **1010101**1 matches with **170** - **1010101**0 ** 255.255.254.0**

**So option A is correct**