Question
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.
| Prefix | Next hop router |
|---|---|
| 10.1.1.0/24 | R1 |
| 10.1.1.128/25 | R2 |
| 10.1.1.64/26 | R3 |
| 10.1.1.192/26 | R4 |
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 _______
Official answer and solution
- Official answer
- 40
- From
- Official GATE 2024 answer key
Solution
Convert each prefix into its 4th-octet address range and apply Longest Prefix Matching (LPM) to each of the 5 destination IP addresses.
All prefixes begin with 10.1.1., so we can express each prefix by the range of its 4th octet:
10.1.1.0/24: (prefix length 24) R110.1.1.128/25: (prefix length 25) R210.1.1.64/26: (prefix length 26) R310.1.1.192/26: (prefix length 26) R4
Applying Longest Prefix Match (LPM) to the 5 hosts (20 packets each):
10.1.1.16: matches only/24R110.1.1.72: matches/24and10.1.1.64/26longest is/26R310.1.1.132: matches/24and10.1.1.128/25longest is/25R2 (20 packets)10.1.1.191: matches/24and10.1.1.128/25longest is/25R2 (20 packets)10.1.1.205: matches/24,10.1.1.128/25, and10.1.1.192/26longest is/26R4
Total packets forwarded via R2 .
40
Routing 10.1.1.205 to R2 by overlooking the longer /26 prefix 10.1.1.192/26 (which would give 60).
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 1 (CS1)
- Question
- 58 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.