Refer to the following routing table output from a Cisco router:
text
Codes: C - connected, S - static, O - OSPF, D - EIGRP
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O 10.1.0.0/16 [110/20] via 192.168.1.2, 00:05:12, GigabitEthernet0/0
D 10.1.4.0/22 [90/307200] via 192.168.1.6, 00:12:33, GigabitEthernet0/1
S 10.1.4.0/24 [1/0] via 192.168.1.10, 01:45:00, GigabitEthernet0/2
O 10.1.4.128/25 [110/10] via 192.168.1.14, 00:02:15, GigabitEthernet0/3
A packet arrives at the router with a destination IP address of . Which exit interface will the router use to forward this packet?
- GigabitEthernet0/3, because the route to 10.1.4.128/25 has the longest matching prefix length for the destination IP address.Answer
- BGigabitEthernet0/2, because the static route has the lowest administrative distance among all candidate routes.
- CGigabitEthernet0/1, because EIGRP has a lower administrative distance than OSPF and matches the destination IP network.
- DGigabitEthernet0/0, because the route to 10.1.0.0/16 covers the largest range of IP addresses in the 10.0.0.0/8 network.
Answer
The router forwards the packet out interface GigabitEthernet0/3 because 10.1.4.128/25 is the longest prefix match for destination 10.1.4.130.
When a router receives an IP packet, it compares the destination IP address against all entries in its routing table. The fundamental rule of IP route selection is Longest Prefix Match (LPM). Since 10.1.4.130 matches 10.1.4.128/25 (/25 bit match), 10.1.4.0/24 (/24 bit match), 10.1.4.0/22 (/22 bit match), and 10.1.0.0/16 (/16 bit match), the router selects 10.1.4.128/25 because /25 is the longest (most specific) prefix length. Consequently, traffic is forwarded via GigabitEthernet0/3.
Step-by-Step Solution
Key Concept
Router Forwarding Decision Logic (Longest Prefix Match precedence over Administrative Distance and Metric)