CS FundamentalsVery hardProduct company interview · GATE level

A router uses longest-prefix matching with these entries: 10.4.0.0/14 -> interface A, 10.6.0.0/15 -> interface B, 10.6.128.0/17 -> interface C, 10.7.64.0/18 -> interface D. How many distinct destination IPv4 addresses are forwarded out of interface B?

  1. A. 114688
  2. B. 131072
  3. C. 98304
  4. D. 81920

Correct answer: D. 81920

10.6.0.0/15 covers 10.6.0.0-10.7.255.255, which is 2^17 = 131072 addresses. Two more specific entries lie inside it: 10.6.128.0/17 (2^15 = 32768 addresses) and 10.7.64.0/18 (2^14 = 16384 addresses), and a longer prefix always wins. So B gets 131072 - 32768 - 16384 = 81920. 131072 ignores both more-specific routes, and 98304 or 114688 subtract only one of them.

More Computer Networks questions

Exams that ask this topic