in Computer Networks edited by
19,679 views
63 votes
63 votes

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

Which $IP$ address should $X$ configure its gateway as?

  1. $192.168.1.67$
  2. $192.168.1.110$
  3. $192.168.1.135$
  4. $192.168.1.155$
in Computer Networks edited by
19.7k views

3 Comments

This might be helpful..

7
7
Host X should feel that Router R1 is present on the same network. Similarly, Router R1 should feel that Host X is present on the same network. So that both of these can send the packet to each other directly. It is only possible when Router R1 is having IP address 192.168.1.110
0
0
trying to explain this question in easy language, if i am wrong please correct me

 

basically is que me ye bol rha hai ki router R1 aur R2 ke pass 2 -2 IP address aaya hai jo routing table ke through apna route dhundenge ab yaha fir que me ye puch raha hai ki bhai aap ye batao ki ye jo total 4 ip address aaye hai na unme se kitne ip address aise honge jo node X ko as as a gatway choose karenge (matlb jb routing tableme ip address jo aaye rahega uska jb hum subnet mask ke sath AND perform ke jb first address uska aur X ke ip adrees ke through jo first adress aayega dono same hoga tab X as a gateway choose hoga
0
0

3 Answers

76 votes
76 votes
Best answer

$X$ must be able to reach the gateway using the net mask.
Subnet number of host $X = 192.168.1.97 \;\&\; 255.255.255.224 = 192.168.1.96$

Now, the gateway must also have the same subnet number. Lets take $\text{IP}\;192.168.1.110$ of $R1. \; 192.168.1.110 \;\&\; 255.255.255.224 = 192.168.1.96$ and hence this can be used by $X$. 

$($To quickly identify the matching mask divide the last part of mask $(224\;\text{here})$ into powers of $2$. So, $224 = 128 + 64+ 32$. Now, our host $X$ has $97$ as the last part of $\text{IP} = 64 + 32 + 1$. So, the last part of subnet number becomes $64 +32 = 96$. Now, we need to consider only those $\text{IPs}$ whose last part will contain $64$ as well as $32)$

http://courses.washington.edu/css432/joemcc/slides/03_cidr.ppt
Correct Answer: $B$

edited by
by

4 Comments

One Doubt sir:-

As after AND operation we get 192.168.1.96.

Can we say as the IP is lying between 192.168.1.0 and 192.168.1.110, so we considered 192.168.1.110 as the answer.

If it would have existed between 192.168.1.110 and 192.168.1.135 then answer would have been 192.168.1.135?
0
0
0
0

if anyone is still confused then check @Hemant Parihar comment in this reply section only its the most important thing I learned today.

1
1
11 votes
11 votes
The concept for this question and all other questions like this is as follows.

The router takes 1 IP address for every interface that it is connected to and the IP address is taken from the same subnet in which the whole network on that interface is.

So here every router is connected to 2 interfaces. Like R1 on the one side is connected to X and on the other side connected to R2. So similarly R2 is connected to R1 and Y.

So both the routers will be having 2 IP addresses. Both IPs in the interface should be in the same network.
So one side of the wire is X and on the second side is R2, So The default gateway for X will be the Ip address that belongs to the same subnet out of 2 IP which R1 has.
So you can get the Ip address router is using on the X side, remaining will be used to communicate by R2. Similarly, R2 has 2 IPs, check which is in the same subnet with the remaining IP of R1.

1 comment

@
Thanks for explaining this.

0
0
7 votes
7 votes
Network mask:255.255.255.224
Subnet bit =3 bit
For: 192.168.1.97
Network address = 192.168.1.01100000 =>192.168.1.96
For:192.168.1.110
Network address=192.168.1.01101110
=>192.168.1.96

3 Comments

@heena Singh here we have 3 bits in subnet ID part so 2^3 = 8 combinations can be used so we will have 8 subnets but last and first subnet id will not be used hence total 6 subnets are possible,But how it is 3 subnets ?
0
0
@sethi  you are right but here question is about gatway not how many subnet possible???

Subnet number of host X = 192.168.1.97 & 255.255.255.224 =192.168.1.96

the gateway must also have the same subnet number.

Take ip addresses and net mask find subnet number if it have same subnet no. then it is used as gatway
1
1
nice explanation.
1
1
Answer:

Related questions