Question

Difficulty: MediumRouter Forwarding Decision Logic

Refer to the following partial IPv4 routing table output from a Cisco router:

Gateway of last resort is 192.168.10.1 to network 0.0.0.0

S* 0.0.0.0/0 [1/0] via 192.168.10.1
D 172.20.0.0/16 [90/307200] via 10.1.1.2, 02:14:10, GigabitEthernet0/0
O 172.20.100.0/24 [110/20] via 10.2.2.2, 01:45:12, GigabitEthernet0/1
R 172.20.100.32/27 [120/2] via 10.3.3.2, 00:12:05, GigabitEthernet0/2

When the router receives an IP packet with a destination address of 172.20.100.50172.20.100.50, to which next-hop IP address and interface will the router forward the packet?

  1. 10.3.3.2 via GigabitEthernet0/2, because 172.20.100.32/27 provides the longest matching subnet mask for the destination IP address.Answer
  2. B
    10.1.1.2 via GigabitEthernet0/0, because EIGRP has a lower administrative distance than OSPF and RIP.
  3. C
    10.2.2.2 via GigabitEthernet0/1, because 172.20.100.50 is outside the usable host range of the /27 subnet.
  4. D
    10.2.2.2 via GigabitEthernet0/1, because OSPF metric is lower than the metric of the RIP route.

Answer

The router forwards the packet to next-hop 10.3.3.2 via interface GigabitEthernet0/2 because 172.20.100.32/27 is the longest prefix match.
When a router makes a forwarding decision, it evaluates all matching routes in the routing table and selects the route with the most specific (longest) subnet mask. The destination IP 172.20.100.50 matches four routes in the routing table: 0.0.0.0/0, 172.20.0.0/16, 172.20.100.0/24, and 172.20.100.32/27 (range 172.20.100.32 to 172.20.100.63). Because /27 has the highest number of matching network bits, the router selects 172.20.100.32/27 and forwards the packet to next-hop 10.3.3.2 out GigabitEthernet0/2.

Step-by-Step Solution

1
Identify all candidate routes matching the destination IP address 172.20.100.50172.20.100.50.
0.0.0.0/00.0.0.0/0 (/0), 172.20.0.0/16172.20.0.0/16 (/16), 172.20.100.0/24172.20.100.0/24 (/24), and 172.20.100.32/27172.20.100.32/27 (/27) all cover 172.20.100.50172.20.100.50.
The range for 172.20.100.32/27172.20.100.32/27 is 172.20.100.32172.20.100.32 to 172.20.100.63172.20.100.63, which includes host .50.50.
2
Compare the prefix lengths of all matching routes.
Prefix lengths are /0, /16, /24, and /27.
The router forwarding engine always selects the matching route with the most specific (longest) prefix mask.
3
Select the route with the maximum prefix length.
Route 172.20.100.32/27172.20.100.32/27 has the longest prefix match (/27).
Administrative Distance (AD) and metric are ignored when routes have different prefix lengths; Longest Prefix Match (LPM) takes strict priority.

Key Concept

Longest Prefix Match (LPM) Rule
Rate this question