Refer to the following excerpt from a Cisco router's IPv4 routing table:
text
Codes: C - connected, S - static, D - EIGRP, O - OSPF
Gateway of last resort is 172.16.1.1 to network 0.0.0.0
D 10.140.0.0/16 [90/2172416] via 10.1.1.1, 00:04:12, GigabitEthernet0/0
O 10.140.32.0/19 [110/20] via 10.2.2.2, 00:12:35, GigabitEthernet0/1
S 10.140.32.0/24 [1/0] via 10.3.3.3
C 10.140.32.128/25 is directly connected, GigabitEthernet0/2
The router receives an IP packet addressed to . Which path or next hop will the router select to forward this traffic?
- Interface GigabitEthernet0/2Answer
- BNext-hop IP address 10.3.3.3
- CNext-hop IP address 10.2.2.2
- DNext-hop IP address 10.1.1.1
Answer
The router will forward the packet out interface GigabitEthernet0/2 because the route 10.140.32.128/25 has the longest matching prefix for destination host 10.140.32.135.
When an IPv4 router receives a packet, it compares the destination IPv4 address against all routes in its routing table. When multiple routes match the destination host, the router always selects the route with the longest prefix length (the most specific subnet mask). Destination falls within (usable range to ). Since is more specific than , , and , the router forwards traffic out GigabitEthernet0/2.
Step-by-Step Solution
Key Concept
Longest Prefix Match (LPM) Precedence