Question

Difficulty: Very hardRouter Forwarding Decision Logic

Refer to the following Cisco CLI routing table output:

text
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

Gateway of last resort is not set

S 172.31.50.0/24 [1/0] via 10.1.1.1, GigabitEthernet0/0/1
D 172.31.50.64/28 [90/307200] via 10.2.2.2, GigabitEthernet0/0/2
O 172.31.50.64/29 [110/20] via 10.3.3.3, GigabitEthernet0/0/3
R 172.31.50.68/30 [120/1] via 10.4.4.4, GigabitEthernet0/0/4

A router receives an IP packet addressed to 172.31.50.67172.31.50.67. Which next-hop IP address will the router select to forward this packet?

  1. 10.3.3.3Answer
  2. B
    10.1.1.1
  3. C
    10.2.2.2
  4. D
    10.4.4.4

Answer

The router forwards the packet to next-hop IP address 10.3.3.3 via interface GigabitEthernet0/0/3.
The correct choice identifies 10.3.3.3 as the next hop because the route 172.31.50.64/29 has the longest matching prefix (/29) among all valid candidate routes covering destination IP 172.31.50.67. A router always prefers the most specific route (longest prefix length) regardless of Administrative Distance or metric.

Step-by-Step Solution

1
Evaluate the target destination IP against all candidate routes in the routing table.
Destination IP 172.31.50.67172.31.50.67 is checked against each prefix mask.
The router must first find all matching subnets.
2
Determine subnet boundaries for candidate routes.
- 172.31.50.0/24 covers 172.31.50.0 to 172.31.50.255 (Match, length /24)
- 172.31.50.64/28 covers 172.31.50.64 to 172.31.50.79 (Match, length /28)
- 172.31.50.64/29 covers 172.31.50.64 to 172.31.50.71 (Match, length /29)
- 172.31.50.68/30 covers 172.31.50.68 to 172.31.50.71 (No match, 67 is outside range)
Routes must cover the target address to be valid candidates.
3
Apply the Longest Prefix Match (LPM) rule among all valid candidate routes.
The valid matching prefixes are /24, /28, and /29. The longest prefix match is /29 (172.31.50.64/29).
Longest Prefix Match is the absolute first criterion used by a router when forwarding packets, taking precedence over Administrative Distance and Metric.
4
Identify the next-hop IP address for the longest prefix match route.
The route 172.31.50.64/29 specifies next-hop IP 10.3.3.3.
Packets are forwarded to the next-hop specified by the winning route.

Key Concept

Longest Prefix Match (LPM) Logic
Rate this question