Refer to the following partial IPv4 routing table output from a Cisco router:
text
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 192.168.1.1
10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O 10.150.0.0/16 [110/20] via 172.16.1.1, 00:10:22, GigabitEthernet0/0/1
D 10.150.45.128/25 [90/307200] via 172.16.2.1, 00:05:12, GigabitEthernet0/0/2
S 10.150.45.136/29 [1/0] via 172.16.3.1
O 10.150.45.136/30 [110/50] via 172.16.4.1, 00:01:45, GigabitEthernet0/0/3
The router receives an IPv4 packet destined for . Which next-hop IP address will the router select to forward this packet?
- 172.16.4.1Answer
- B172.16.3.1
- C172.16.2.1
- D172.16.1.1
Answer
The router forwards the packet to next-hop IP address 172.16.4.1.
When a router receives a packet, it compares the destination IP address against all entries in its routing table. The rule of Longest Prefix Match (LPM) dictates that the route with the most specific (longest) subnet mask is selected. The target IP address 10.150.45.138 matches multiple routes, but 10.150.45.136/30 has the longest prefix mask (/30 vs /29, /25, /16, /0). The next-hop IP for 10.150.45.136/30 is 172.16.4.1.
Step-by-Step Solution
Key Concept
Router Forwarding Decision Logic (Longest Prefix Match Rule)
Estimated Time:1m 30s