Soru

Zorluk: OrtaRouter Forwarding Decision Logic

An engineer is troubleshooting packet forwarding on router R1. A packet arrives at R1 with a destination IP address of 172.16.45.100.

Refer to the command output from R1:

text
R1# show ip route
Gateway of last resort is 10.0.0.5 to network 0.0.0.0

S* 0.0.0.0/0 [1/0] via 10.0.0.5
S 172.16.0.0/16 [1/0] via 10.0.0.1
O 172.16.45.0/24 [110/20] via 10.0.0.2
B 172.16.45.96/28 [20/0] via 10.0.0.4

Which next-hop IP address will router R1 use to forward this packet?

  1. 10.0.0.4Cevap
  2. B
    10.0.0.1
  3. C
    10.0.0.2
  4. D
    10.0.0.5

Cevap

Router R1 will forward the packet to the next-hop IP address 10.0.0.4 based on the Longest Prefix Match rule.
When a router receives a packet, it compares the destination IP address against all routes in the routing table. If multiple routes match, the router strictly prefers the route with the most specific (longest) subnet mask (Longest Prefix Match). In this scenario, 172.16.45.100 matches 0.0.0.0/0, 172.16.0.0/16, 172.16.45.0/24, and 172.16.45.96/28. The /28 prefix is the longest match, so the packet is routed via next-hop 10.0.0.4.

Adım Adım Çözüm

1
Identify all candidate routes matching the destination address 172.16.45.100.
The destination address matches 0.0.0.0/0, 172.16.0.0/16, 172.16.45.0/24, and 172.16.45.96/28.
172.16.45.96/28 spans usable IP range 172.16.45.97 to 172.16.45.110, which includes 172.16.45.100.
2
Compare prefix lengths of all matching candidate routes.
Prefix lengths are /0, /16, /24, and /28.
Router forwarding logic relies first on Longest Prefix Match (LPM) to choose the most specific route.
3
Select the route with the most specific (longest) prefix mask.
The route B 172.16.45.96/28 with next-hop 10.0.0.4 has the longest mask (/28).
LPM supersedes Administrative Distance and Metric during route selection.

Anahtar Kavram

Router Forwarding Decision Logic & Longest Prefix Match
Bu soruyu puanla