Question
The forwarding table of a router is shown below.
| Subnet Number | Subnet Mask | Interface ID |
|---|---|---|
| 200.150.0.0 | 255.255.0.0 | 1 |
| 200.150.64.0 | 255.255.224.0 | 2 |
| 200.150.68.0 | 255.255.255.0 | 3 |
| 200.150.68.64 | 255.255.255.224 | 4 |
| Default | 0 |
A packet addressed to a destination address 200.150.68.118 arrives at the router. It will be forwarded to the interface with ID _______.
Official answer and solution
- Official answer
- 3
- From
- Official GATE 2023 answer key
Solution
Perform longest prefix matching for destination IP 200.150.68.118 against routing table entries.
Destination address: .
In binary, fourth octet .
-
Subnet 4:
200.150.68.64, mask255.255.255.224(/27)- Mask fourth octet:
- Target subnet octet is . Since , this does NOT match.
-
Subnet 3:
200.150.68.0, mask255.255.255.0(/24)- Matches! Prefix length = 24 bits.
-
Subnet 2:
200.150.64.0, mask255.255.224.0(/19)- Matches, with prefix length = 19 bits.
-
Subnet 1:
200.150.0.0, mask255.255.0.0(/16)- Matches, with prefix length = 16 bits.
Under Longest Prefix Matching (LPM), the router selects the entry with the longest matching subnet mask. Subnet 3 has the longest mask (/24). Therefore, the packet is forwarded to Interface 3.
3
Assuming Subnet 4 matches because , failing to perform the bitwise AND with mask 224.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2023 Computer Science and Information Technology (CS)
- Question
- 65 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.