A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to?
| Subnet Address | Subnet Mask (in CIDR notation) | Interface |
|---|---|---|
| 145.36.0.0 | /16 | E1 |
| 145.36.128.0 | /17 | E2 |
| 145.36.64.0 | /18 | E3 |
| 145.36.255.0 | /24 | E4 |
| Default | -- | E5 |
GATE CS - 2025,
Answer: A
The packet is forwarded to E3.
A router uses longest prefix match. The destination's third octet is 109 = 01101101 in binary. Check each entry:
- 145.36.0.0/16 matches, since the first two octets agree.
- 145.36.128.0/17 needs the first bit of the third octet to be 1 (128 to 255); 109 starts with 0, so no match.
- 145.36.64.0/18 needs the first two bits of the third octet to be 01 (64 to 127); 109 starts 01, so it matches.
- 145.36.255.0/24 needs the third octet to be 255; no match.
Of the matching entries, /18 is longer than /16, so the packet goes out on E3. E1 is what a router would choose if it ignored the longest match, E2's range 128 to 255 does not contain 109, and the default route E5 is used only when nothing else matches.
Please log in or register to report this question.
