GATE | Gate IT 2008 | Question 81

Host X has IP address 192.168.1.97 and is connected through two routers R1 and R2 to an­other host Y with IP address 192.168.1.80. Router R1 has IP addresses 192.168.1.135 and 192.168.1.110. R2 has IP addresses 192.168.1.67 and 192.168.1.155. The netmask used in the network is 255.255.255.224.

Given the information above, how many distinct subnets are guaranteed to already exist in the network?
(A) 1
(B) 2
(C) 3
(D) 6


Answer: (C)

Explanation: Given IP addresses are of Class C
default Mask for class C = 24
Here given mask is 11 bits ( 11111111 11111111 11111111 11100000)
subnet ID: 3 bits
existing subnets: 011, 010 and 100

Alternative approach –
Each link which connects a router-router, or a router-host(s) has a different subnet. In this case, there are 3 subnets,

  1. One connecting Host X to Router R_1
  2. One connecting Router R_1 to Router R_2
  3. One connecting Router R_2 to Host Y

We can also find the number of subnets by couting the number of network prefixes as each network ID corresponds to a subnet. Subnet Mask – 255.255.255.224 or /27.
In the following table, Network ID only displays bits 24 to 26 since bits 0 to 23 are the same for all subnets. Subnet ID is obtained after AND’ing the IP address with the subnet Mask.
 \begin{tabular}{||c||c||c||} \hline IP & Subnet ID & Network ID(Bits 24-26)\\ \hline \hline 192.168.1.97 & 192.168.1.96 & 011\\  \hline 192.168.1.110 &192.168.1.96 & 011\\  \hline 192.168.1.135 & 192.168.1.128 & 100\\  \hline 192.168.1.155 & 192.168.1.128 &100\\  \hline 192.168.1.67 & 192.168.1.64 & 010\\  \hline 192.168.1.80 & 192.168.1.64 & 010\\  \hline \end{tabular}
Therefore option (C) is correct.



This explanation is provided by Chirag Manwani.

Quiz of this Question



My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.