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

The routing table of a router  is shown below:

Destination Subnet Mask Interface Eth0 Eth1 Eth3
Default   Eth2

On which interface will the router forward packets addressed to destinations and respectively?

  1. Eth1 and Eth2
  2. Eth0 and Eth2
  3. Eth0 and Eth3
  4. Eth1 and Eth3
asked in Computer Networks by Veteran (69k points)
retagged by | 2.4k views

Entries in the routing table are stored in sorted manner based on subnet mask. the IP will be compared first with, match is found hence, packet will be forwarded to Eth1 instead to Eth0.

If more than one entry matches, then send the packets to one having larger subnet mask (more 1's in subnet mask).

3 Answers

+34 votes
Best answer

The Answer must be A.

For 1st packet,

( && ( = ( since {16 && 0 = 0}, as well as 

( && ( = ( since {16 && 128 = 0}.

Now, since both these subnet masks are producing the same Network ID, hence The one with greater number of ones will be selected, and the packet will be forwarded there. Hence packet 1 will be forwarded to Eth1.

For 2nd packet,

( when anded with each of the subnet masks does not match with any of the network ID, since:

( && ( = ( {Does not match with any of the network addresses}

( && ( = ( {Does not match with any of the network addresses}

( && ( = ( {Does not match with any of the network addresses}

Hence, Default interface must be selected for packet 2, i.e Interface Eth2.

answered by Active (1.5k points)
selected by
Why to select n/w id with greater number of one's here?

How default interface is Eth2.

I think it should be Eth3.
@khushtak  If two interfaces matches with the given address, then we should send the data to the interface having longest prefix match which is nothing but the interface having large subnet mask (more number of 1's)
Any reference ?
+1 vote

How router makes decisions ?

Router check the destination address by decapsulating packet and perform bitwise AND with subnet mask of all interfaces and if the resulting n/w address matches with corresponding interface n/w address then router send packet to this interface , in case of tie , router uses Longest prefix match

interface eth0 :- ( to

interface eth1 :- ( to

for we can see there is a tie as it falls within the n/w addresses for eth0 and eth1...which route would the router choose? It depends on the prefix length, or the number of bits set in the subnet mask. Longer prefixes are always preferred over shorter ones when forwarding a packet.


answered by Veteran (11.4k points)
–3 votes
ans c)
answered by Boss (5.1k points)
@Aditi , why you always write only option and option which is wrong(most of time).

May be your target is get maximum negative votes or downvotes . Good keep it up

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

33,688 questions
40,231 answers
38,803 users