GATE CS 2024 Set 1 | Question 58

NAT · 2 marks

Consider the entries shown below in the forwarding table of an IP router. Each entry consists of an IP prefix and the corresponding next hop router for packets whose destination IP address matches the prefix. The notation “/N” in a prefix indicates a subnet mask with the most significant N bits set to 1.

PrefixNext hop router
10.1.1.0/24R1
10.1.1.128/25R2
10.1.1.64/26R3
10.1.1.192/26R4

This router forwards 20 packets each to 5 hosts. The IP addresses of the hosts are 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, and 10.1.1.205 . The number of packets forwarded via the next hop router R2 is _______

Answer

40

Explanation

A router sends each packet by the longest prefix that matches its destination. In the last byte, 10.1.1.128/25 covers 128–255, 10.1.1.64/26 covers 64–127, 10.1.1.192/26 covers 192–255, and the /24 matches every 10.1.1.x address.

  • 10.1.1.16 matches only the /24: R1.
  • 10.1.1.72 matches the /24 and 10.1.1.64/26: R3.
  • 10.1.1.132 and 10.1.1.191 match the /24 and the /25 but not 10.1.1.192/26 (191 is just below 192): R2.
  • 10.1.1.205 matches the /24, the /25 and 10.1.1.192/26; the /26 is the longest: R4.

Two hosts are reached via R2, so \(2 \times 20 = 40\) packets go through it.

Answer: 40