CIDR

GATE | GATE-CS-2014-(Set-3) 

Classless Inter-domain Routing (CIDR) receives a packet with address 131.23.151.76. The router’s routing table has the following entries:

Prefix           Output Interface Identifier
131.16.0.0/12              3
131.28.0.0/14              5
131.19.0.0/16              2
131.22.0.0/15              1

The identifier of the output interface on which this packet will be forwarded is ______.
(A) 1
(B) 2
(C) 3
(D) 5

 

Plz explain... Why forwarded to 1

4Comments
Ashish Kumar Goyal @dashish
23 Jan 2017 06:05 pm

I am gettinng both 3 and 1..

Shraddha @shraddhagami
23 Jan 2017 06:12 pm

I think both answer are correct.

Ashish Kumar Goyal @dashish
23 Jan 2017 06:39 pm

@shraddhagami

I found a solution somewhere. pls check this:-

 In this question, we need to find out Netmask for each entry and BITWISE AND with given packet address, whichever equals the Netid, is the ans. Ex. 1st entry in table: 131.16.0.0/12. its MASK is first 12 bits of network(they are all 1) and remaining 20 bits of host(they are all 0). so MASK is 255.240.0.0 AND 131.23.151.76 = 131.16.0.0. Last entry is 131.22.0.0/15 MASK—>255.254.0.0 AND 131.23.151.76 = 131.22.0.0. Two ans coming interfaces 1,3.

Longest Prefix Matching is used to decide among two. When one destination address matches more than one forwarding table entry. The most specific of the matching table entries is used as the interface.

The interface 1 has the longest matching prefix with the input IP address. Therefore 1 is chosen.

 

Shobhit @sudsho
23 Jan 2017 07:16 pm

^ ur explanation is right..

Pages