Open In App

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

Like Article
Like
Save
Share
Report

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


Answer: (A)

Explanation: 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.


Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads