Question

Difficulty: HardRouting Concepts and Dynamic Routing Protocols

A layer 3 switch on a multi-site network receives a frame carrying an IP packet addressed to host 10.120.4.13810.120.4.138. The switch's Routing Information Base (RIB) contains four active candidate route entries matching the destination address:

PrefixProtocol SourceAdministrative DistanceMetricNext-Hop Interface
10.120.4.0/2310.120.4.0/23Static10GigabitEthernet0/1
10.120.4.128/2510.120.4.128/25OSPF11045GigabitEthernet0/2
10.120.4.128/2610.120.4.128/26RIPv21202GigabitEthernet0/3
10.120.4.136/2910.120.4.136/29EIGRP901560GigabitEthernet0/4

Which next-hop interface will the layer 3 switch select to forward this packet?

  1. GigabitEthernet0/4, because the EIGRP entry provides the longest prefix match for the destination address.Answer
  2. B
    GigabitEthernet0/1, because the static route entry possesses the lowest administrative distance value.
  3. C
    GigabitEthernet0/3, because the RIPv2 path has the lowest numerical metric value.
  4. D
    GigabitEthernet0/2, because OSPF link-state announcements automatically supersede distance-vector protocol entries.

Answer

GigabitEthernet0/4 is selected because the 10.120.4.136/2910.120.4.136/29 route provides the longest subnet mask match for destination address 10.120.4.13810.120.4.138.
When a router or layer 3 switch forwards a packet, it compares the packet's destination IP address against all entries in its routing table. The primary criteria for path selection is Longest Prefix Match (LPM)—the route with the highest number of matching network bits (most specific subnet mask). Here, 10.120.4.136/2910.120.4.136/29 covers 10.120.4.13610.120.4.136 through 10.120.4.14310.120.4.143, which includes 10.120.4.13810.120.4.138. Because /29/29 is more specific than /26/26, /25/25, or /23/23, the switch forwards the packet out GigabitEthernet0/4 immediately.

Step-by-Step Solution

1
Evaluate subnet coverage for destination address 10.120.4.13810.120.4.138 against each candidate route prefix in the RIB.
All four routes cover the host address: 10.120.4.0/2310.120.4.0/23 (10.120.4.010.120.4.010.120.5.25510.120.5.255), 10.120.4.128/2510.120.4.128/25 (10.120.4.12810.120.4.12810.120.4.25510.120.4.255), 10.120.4.128/2610.120.4.128/26 (10.120.4.12810.120.4.12810.120.4.19110.120.4.191), and 10.120.4.136/2910.120.4.136/29 (10.120.4.13610.120.4.13610.120.4.14310.120.4.143).
Before comparing protocols, the router must identify all valid matching prefixes.
2
Determine prefix length specificity for all matching candidate routes.
The prefix masks are /23/23, /25/25, /26/26, and /29/29. The /29/29 mask has 29 network bits, making it the most specific route.
The fundamental routing logic rule dictates that the longest prefix match (LPM) always wins regardless of administrative distance or protocol metric.
3
Select the egress interface tied to the longest prefix match.
The route for 10.120.4.136/2910.120.4.136/29 points to next-hop interface GigabitEthernet0/4.
Because /29/29 is the longest matching prefix, the router immediately selects GigabitEthernet0/4 without evaluating administrative distance or metric values.

Key Concept

Longest Prefix Match (LPM) Path Selection Hierarchy
Estimated Time:1m 30s
Rate this question