A network engineer is analyzing the forwarding behavior of router R1 for traffic destined to IP address . The router currently has an active OSPFv2 process that learns prefix (Administrative Distance 110). Additionally, the administrator configures three IPv4 static routes on R1:
- Command 1: `ip route 172.20.16.0 255.255.240.0 10.0.0.2 115`
- Command 2: `ip route 172.20.16.0 255.255.255.0 10.0.1.2`
- Command 3: `ip route 172.20.16.32 255.255.255.224 10.0.2.2 120`
Assuming all next-hop IP addresses (, , and ) are reachable via directly connected subnets, which route will router R1 use to forward the packet destined to , and why?
- The static route from Command 3 via next-hop 10.0.2.2, because it is installed in the routing table and has the longest prefix match (/27) for the destination IP address.Answer
- BThe static route from Command 2 via next-hop 10.0.1.2, because it has the lowest Administrative Distance (1) among all valid static routes matching the destination.
- CThe OSPF dynamic route via next-hop 10.0.0.2, because Command 1 and Command 3 both have Administrative Distances higher than OSPF (110) and are ignored.
- DThe static route from Command 1 via next-hop 10.0.0.2, because static routes always take precedence over dynamic protocols regardless of prefix length or Administrative Distance.
Answer
The router forwards the packet via the static route from Command 3 (next-hop 10.0.2.2) because it is installed in the routing table and provides the longest prefix match (/27) for IP address 172.20.16.45.
The correct answer identifies that the static route configured in Command 3 via next-hop 10.0.2.2 is installed in the routing table and selected via the Longest Prefix Match rule. AD comparison only suppresses a route when another protocol offers the exact same destination prefix and mask with a lower AD. Because Command 3 specifies 172.20.16.32/27, no exact match conflict exists with OSPF (172.20.16.0/20) or Command 2 (172.20.16.0/24), allowing Command 3 into the routing table. When forwarding a packet to 172.20.16.45, the router evaluates all installed routes matching the IP address and picks /27 as the longest prefix match.
Step-by-Step Solution
Key Concept
Routing Table Installation (AD Comparison for Exact Matches) vs Packet Forwarding Logic (Longest Prefix Match)