The routing table of a router is shown below:
On which interface will the router forward packets addressed to destinations and respectively?
View worked solution
Answer: A
To determine the forwarding interface for each destination IP address, we perform a bitwise AND operation between the destination IP and the subnet mask of each entry in the routing table. If multiple entries match, the router selects the interface corresponding to the Longest Prefix Match (the one with the longest subnet mask / most 1s).
1. For Destination IP:
- Row 1 (Eth0):
Subnet Mask: (/24)
Bitwise AND:
Result: Match (Prefix length = 24) - Row 2 (Eth1):
Subnet Mask: (/25)
Bitwise AND:
Since the last octet in binary is and is , their bitwise AND is .
Thus, the result is .
Result: Match (Prefix length = 25) - Row 3 (Eth3):
Subnet Mask: (/32)
Bitwise AND:
Result: No Match
Since both Row 1 and Row 2 match, we apply the Longest Prefix Match rule. Row 2 has a longer subnet mask (/25 vs /24). Therefore, the packet is forwarded to Eth1.
2. For Destination IP:
- Row 1 (Eth0): (No Match)
- Row 2 (Eth1): (No Match)
- Row 3 (Eth3): (No Match)
- Default (Eth2): Matches when no other specific route matches.
Therefore, the packet is forwarded to Eth2.
Thus, the interfaces are Eth1 and Eth2 respectively.
Free practice · Your answers on this page are not saved.
