An enterprise Cisco router receives an IPv4 packet destined for IP address 192.168.50.75. The router's routing table contains the following entries:
text
Codes: C - connected, S - static, O - OSPF, D - EIGRP
Gateway of last resort is not set
192.168.50.0/24 is variably subnetted, 4 subnets, 3 masks
O 192.168.50.0/24 [110/20] via 10.1.1.1, 00:14:22, GigabitEthernet0/0
S 192.168.50.0/25 [1/0] via 10.3.3.3
D 192.168.50.64/26 [90/30720] via 10.2.2.2, 00:08:15, GigabitEthernet0/1
C 192.168.50.64/28 is directly connected, GigabitEthernet0/2
Which forwarding path will the router select to forward this packet?
- Out GigabitEthernet0/2, because 192.168.50.64/28 provides the longest matching prefix for the destination IP address.Answer
- BVia next-hop 10.3.3.3, because static routes have a lower administrative distance (1) than directly connected or dynamic routes.
- CVia next-hop 10.2.2.2, because the EIGRP route provides the optimal balance of administrative distance and subnet mask specificity.
- DVia next-hop 10.1.1.1, because the /24 route represents the parent network covering all subnets.
Answer
The router will forward the packet out interface GigabitEthernet0/2 because the directly connected prefix 192.168.50.64/28 provides the longest prefix match (28 matching bits) for the destination IP 192.168.50.75.
When a router makes a packet forwarding decision, it checks all routes in the IPv4 routing table that encompass the destination IP address. The fundamental rule of IP routing is Longest Prefix Match (LPM): the route with the most specific prefix length (largest prefix number) is selected. Here, the target IP 192.168.50.75 falls into 192.168.50.64/28 (range .64 to .79). Because /28 is longer than /26, /25, and /24, the router forwards the packet directly out GigabitEthernet0/2.
Step-by-Step Solution
Key Concept
Longest Prefix Match (LPM) Rule in Cisco IPv4 Routing