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

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

Prefix           Output Interface Identifier              3              5              2              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

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


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: 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 AND = Last entry is MASK—> AND = 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..