The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+27 votes

Host $X$ has IP address $$ and is connected through two routers $R1$ and $R2$ to an­other host $Y$ with IP address $$. Router $R1$ has IP addresses $$ and $$. $R2$ has IP addresses $$ and $$. The netmask used in the network is $$.

Given the information above, how many distinct subnets are guaranteed to already exist in the network?

  1. $1$
  2. $2$
  3. $3$
  4. $6$
asked in Computer Networks by Boss (19.1k points)
edited by | 2.9k views
Option C, Just perform bit wise AND of given IP addresses and subnet mask, we get 3 distinct subnet id
1) 011
2) 010
3) 100
routers also counted in subnets?
what the significance can someone explain?
Find first addresses i.e netaddress of all given IP's using subnetmask.You will find there are only three subnets.
Router's Interfaces have the same netId as the network they are part of. Here, three distinct netIDs are present, implying three sub-nets.
Actually, if there are 2 routers connected via a single interface, then that interface needs to be given a subnet ! And this the subnet id for the common interface between routers is -

Apart from this there are 2 more subnets in the network in which both the hosts are present distinctly - for 'X' and for 'Y'.

Also the interfaces of the routers connected to these hosts have IP addresses taken from the above 2 subnets respectively only !

i think (3) should be 000.
THIS SHOULD BE 2 ,becoz question is asking about distinct



@bikram sir

since we are calculating subnet-ids for each subnet by performing AND operation and finding no. of possible subnets as for each subnet a subnet id will exist.. dats fine...and giving answer which is asked in ques. but  why can't  we do like the normal method of calculating no. of subnets :

subnet mask :

no of subnets = (2^3) - 2 

4 Answers

+21 votes
Best answer

$  =  11111111.11111111.11111111.11100000$


We need to do bitwise AND with subnet mask.
the last $5$ bits are going to be 0 when ANDED.

No need to waste time in finding binary.
Only focus on $1$st $3$ bits of binary.  

(From left side, $1$st bit is $128$,next one is $64$,next one is $32$ goes like that you know.)

$\bf{97}$:    $0 + 64 + 32 +$ something  so $1$st $3$ bits will contain $011$
$\bf{80}$:    $0 + 64 + 0+$ something  so $010$
$\bf{135}$:  $128+0+0+$ something so $100$
$\bf{110}$:  $0+64+32+$ something so $011$
$\bf{67}$:    $0+64+0+$ something so $010$
$\bf{155}$:  $128+0+0+$ something so $100$

So we got $011, 010, 100$
$3$ subnets.... subnet id are...


answered by Boss (11.7k points)
edited by

Acc. to the topology given, there will be three networks :

N1: X and the interface of R1 connected to X

N2: Network containing the interfaces of R1 and R2 connected to each other

N3: Y and the interface of R2 connected to Y.

So why do we need to do ANDing?

Topology? Where?
Read the question. The topology will be like the diagram in my previous question
From this diagram how can you conclude there are 3 subnets? I did not get.
Okay, my mistake. From the diagram, it is evident that there are 3 networks. But to determine if they are subnets or not, we need to do ANDing. I missed the term distinct "subnets" in the question :|

in the question, they given that

how many distinct subnets are guaranteed

if it is class-less, questioner can't use the term subnet why because every subnet is a network in class-less. therefore it should be class-full IP address,

there are 3 networks, check each network network id's before subnetting.  ===> all 3 networks from same network before subnetting

∴ 3 subnets are guaranteed to already exist in the network.


@Shaik Masthan brother how a router can have two ip addresses? How's this possible?

router have so many interfaces, each interface is connected to one network ===> each interface assigned to a ip address which is from the pool of available ip address of the connected network.

In this question, each router has two interfaces, so each of router gets 2 ip address.
Makes sense thanks @Shaik.

Why structure can't be this? @Shaik Masthan @Sumaiya23 can you please explain this?


Host X has IP address and is connected $\color{red}{through\; two\; routers}$ R1 and R2 to an­other host Y

it means they are in series but not in parallel.


@Shaik Masthan thank you.

but if the situation is parallel then will 4 networks present?


@soumayan bandhu

a router can have more than one interface, but a network can have more than one interface ?

Oh, sorry it was a bad question.

Host must be reside in a single network

@Shaik Masthan

can you please check this understanding..sorry if something silly

1) If a host in network has to send packet to host on another network then first it should sent it to default router of are R1 and R2 are considered as default routers of networks in which Host X and Y are present respt.

2) From IP of X and Y and host we found that X and Y are in diff networks so 2 distinct subnets ..noow they are connected by two routers R1 and R2 for Interface 2 of R1 and Inteface 1 of R2 IP's should be in such a way that both R1 and R2 seems to be in same network so that to forward packet from R1 to R2..R1 will get MAC of R2 using ARP..hence that will create one new subnet there may not be any hosts in that 3rd subnet other than R1 and R2


i didn't get you @jatin khachane 1


@Shaik Masthan in the above diagram where I said parallel connection,can we say that both R1 and R2 situated into the same network ?

because a network can't have two interfaces.

And can't we connect a single network with two different routers?

+5 votes
Given all address are of class c Default mask for class c=24bit Given net mask = 11111111.11111111.11111111.11100000 Subnet id=3bit Simply BITWISE AND the bits of the first octet for each of the IP addresses we got 011, 010, 100 3 subnets. subnet id are
answered by Junior (935 points)
+2 votes
Simply BITWISE AND the bits of the first octet for each of the following IP addresses . You will get only
xx.xx.xx.96 ,xx.xx.xx.64 and xx.xx.xx.128  
Option C) 3 is the answer
answered by Active (3.8k points)
edited by
Not XOR,  bitwise AND.
Oh sorry.. !! :P
0 votes


answered by (11 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,122 questions
53,242 answers
70,480 users