Question

Difficulty: Very hardIPv4 Static Routing

A network engineer is analyzing the forwarding behavior of router R1 for traffic destined to IP address 172.20.16.45172.20.16.45. The router currently has an active OSPFv2 process that learns prefix 172.20.16.0/20172.20.16.0/20 (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 (10.0.0.210.0.0.2, 10.0.1.210.0.1.2, and 10.0.2.210.0.2.2) are reachable via directly connected subnets, which route will router R1 use to forward the packet destined to 172.20.16.45172.20.16.45, and why?

  1. 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
  2. B
    The 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.
  3. C
    The 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.
  4. D
    The 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

1
Evaluate Routing Information Base (RIB) installation for each static route based on Administrative Distance (AD).
Command 1 (172.20.16.0/20, AD 115) matches OSPF prefix 172.20.16.0/20 (AD 110). Because OSPF AD < 115, Command 1 is not installed (floating static route). Command 2 (172.20.16.0/24, default AD 1) and Command 3 (172.20.16.32/27, AD 120) have unique prefixes, so AD comparison against OSPF does not prevent their installation.
Administrative Distance is only compared between routes with identical prefix and subnet mask definitions.
2
Determine which installed RIB entries match destination IP 172.20.16.45.
Matching installed routes: OSPF (172.20.16.0/20), Command 2 static route (172.20.16.0/24), and Command 3 static route (172.20.16.32/27).
172.20.16.45 falls within the host ranges of all three installed subnets: /20 (172.20.16.0 - 172.20.31.255), /24 (172.20.16.0 - 172.20.16.255), and /27 (172.20.16.32 - 172.20.16.63).
3
Apply router forwarding decision logic to select the active path for the packet.
Select 172.20.16.32/27 via next-hop 10.0.2.2.
Routers select paths based on the Longest Prefix Match (LPM) rule. A /27 prefix (27 mask bits) is longer and more specific than /24 or /20.

Key Concept

Routing Table Installation (AD Comparison for Exact Matches) vs Packet Forwarding Logic (Longest Prefix Match)
Rate this question