The GATE Grind

GATE 2023 CS – Question 65

Computer Networks · IPv4: Addressing, CIDR, Fragmentation and NAT · 2 marks · Numerical answer

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 ______.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 3

Explanation

The destination address is $200.150.68.118$. Check each entry:

EntryRange coveredMatches?
200.150.0.0 / 255.255.0.0 (/16)200.150.0.0 – 200.150.255.255yes
200.150.64.0 / 255.255.224.0 (/19)third octet 64–95yes (68 is in range)
200.150.68.0 / 255.255.255.0 (/24)200.150.68.0 – .255yes
200.150.68.64 / 255.255.255.224 (/27)200.150.68.64 – .95no (118 > 95)

The /16, /19 and /24 entries match. The routing rule is **longest prefix match**, so the /24 entry wins: interface **3**.

More IPv4: Addressing, CIDR, Fragmentation and NAT questions

All IPv4: Addressing, CIDR, Fragmentation and NAT questions →