Question
Consider the following routing table at an IP router:
| Network No. | Net Mask | Next Hop |
| 128.96.170.0 | 255.255.254.0 | Interface 0 |
| 128.96.168.0 | 255.255.254.0 | Interface 1 |
| 128.96.166.0 | 255.255.254.0 | R2 |
| 128.96.164.0 | 255.255.252.0 | R3 |
| 0.0.0.0 | Default | R4 |
For each IP address in Group I identify the correct choice of the next hop from Group II using the entries from the routing table above.
Group I
i) 128.96.171.92
ii) 128.96.167.151
iii) 128.96.163.151
iv) 128.96.165.121
Group II
a) Interface 0
b) Interface 1
c) R2
d) R3
e) R4
Official answer and solution
- Official answer
- A
- From
- Official GATE 2015 answer key
Solution
Perform longest prefix matching by bitwise-ANDing destination IP addresses with routing table masks.
We evaluate each IP address against the routing table prefixes:
- IP (i) 128.96.171.92:
- Mask
255.255.254.0(/23): The third octet has mask .Result:128.96.170.0. Matches row 1 Interface 0 (a).
- IP (ii) 128.96.167.151:
- Mask
255.255.254.0:Result:128.96.166.0. Matches row 3 R2 (c).
- IP (iii) 128.96.163.151:
- Mask
255.255.254.0: (no match). - Mask
255.255.252.0(/22): . - No specific network match Default route R4 (e).
- IP (iv) 128.96.165.121:
- Mask
255.255.254.0: (no match with 170, 168, or 166). - Mask
255.255.252.0:Result:128.96.164.0. Matches row 4 R3 (d).
Matching: i-a, ii-c, iii-e, iv-d (option A).
A
Miscalculating the bitwise AND with mask 254 or 252, confusing 163 AND 252 (= 160) with 164.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 2
- Question
- 51 of 65, printed as CS Q.41
- 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.