Examine the following IPv4 routing table output from a Cisco router:
text
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
Gateway of last resort is not set
192.168.10.0/24 is subnetted, 3 subnets
O 192.168.10.0/24 [110/20] via 10.1.1.1, 00:05:12, GigabitEthernet0/0
D 192.168.10.0/28 [90/307200] via 10.1.1.2, 00:12:45, GigabitEthernet0/1
S 192.168.10.0/26 [1/0] via 10.1.1.3
The router receives a packet destined for IP address 192.168.10.14. Which next-hop IP address will the router use to forward this packet?
- 10.1.1.2Answer
- B10.1.1.3
- C10.1.1.1
- D0.0.0.0
Answer
The router forwards the packet to next-hop address 10.1.1.2 because 192.168.10.0/28 is the longest prefix match for destination IP address 192.168.10.14.
When a router receives a packet, it compares the destination IP address against all entries in its routing table and selects the route with the most specific match (longest subnet mask length). Destination IP 192.168.10.14 matches the /24, /26, and /28 prefixes. Because /28 is the longest prefix mask (255.255.255.240), the router uses the route pointing to next-hop 10.1.1.2.
Step-by-Step Solution
Key Concept
Longest Prefix Match Rule