Skip to content

GATE CS 2014 Set 3 Q26 — Routing Protocols: Shortest Path, Flooding, Distance Vector, Link State

Explain with AI
An IP router implementing Classless Inter-domain Routing (CIDR) receives a packet with address 131.23.151.76131.23.151.76. The router's routing table has the following entries:
PrefixOuter Interface Identifier131.16.0.0/123 131.28.0.0/145131.19.0.0/162131.22.0.0/151\begin{array}{|c|c|c|} \hline \textbf{Prefix} & \textbf{Outer Interface Identifier} \\ \hline \text{131.16.0.0/12} & \text{3 } \\ \hline \text{131.28.0.0/14} & \text{5} \\ \hline \text{131.19.0.0/16} & \text{2} \\ \hline \text{131.22.0.0/15} & \text{1} \\ \hline \end{array}
The identifier of the output interface on which this packet will be forwarded is ______.
View worked solution

Answer: 1

To find the correct output interface, we convert the destination IP address and the routing table prefixes into binary to find the matching entries, and then apply the Longest Prefix Match (LPM) rule.

The destination IP address is 131.23.151.76. Let's convert the first two octets to binary:

  • 131=100000112131 = 10000011_2
  • 23=00010111223 = 00010111_2

Now, we check the prefixes in the routing table:

  1. 131.16.0.0/12:
    • Prefix first 12 bits: 10000011.0001210000011.0001_2
    • Destination IP first 12 bits: 10000011.0001210000011.0001_2 (Matches)
  2. 131.28.0.0/14:
    • Prefix first 14 bits: 10000011.000111210000011.000111_2
    • Destination IP first 14 bits: 10000011.000101210000011.000101_2 (Does not match)
  3. 131.19.0.0/16:
    • Prefix first 16 bits: 10000011.00010011210000011.00010011_2
    • Destination IP first 16 bits: 10000011.00010111210000011.00010111_2 (Does not match)
  4. 131.22.0.0/15:
    • Prefix first 15 bits: 10000011.0001011210000011.0001011_2 (since 22=00010110222 = 00010110_2)
    • Destination IP first 15 bits: 10000011.0001011210000011.0001011_2 (Matches)

Both 131.16.0.0/12 and 131.22.0.0/15 match the destination IP. By the Longest Prefix Match rule, the router selects the prefix with the longest mask (/15>/12/15 > /12).

Thus, the packet is forwarded to interface 1.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Routing Protocols: Shortest Path, Flooding, Distance Vector, Link State questions