Refer to the following partial IPv4 routing table output from a Cisco router:
text
Codes: C - connected, S - static, R - RIP, D - EIGRP, O - OSPF, B - BGP
S 192.168.1.0/24 [1/0] via 10.0.0.3, GigabitEthernet0/0/3
D 192.168.1.128/25 [90/307200] via 10.0.0.2, GigabitEthernet0/0/2
O 192.168.1.128/26 [110/20] via 10.0.0.1, GigabitEthernet0/0/1
B 192.168.1.136/29 [20/0] via 10.0.0.4, GigabitEthernet0/0/4
The router receives a packet destined for host IPv4 address 192.168.1.138. Which next-hop IPv address and exit interface will the router select to forward this packet?
- 10.0.0.4 via GigabitEthernet0/0/4, because the /29 prefix provides the longest prefix match for the destination IP address.Cevap
- B10.0.0.3 via GigabitEthernet0/0/3, because the static route has the lowest administrative distance of 1.
- C10.0.0.2 via GigabitEthernet0/0/2, because EIGRP routes take precedence over OSPF and BGP routes regardless of prefix length.
- D10.0.0.1 via GigabitEthernet0/0/1, because 192.168.1.138 falls outside the usable host range of the /29 subnet.
Cevap
10.0.0.4 via GigabitEthernet0/0/4, because the /29 prefix provides the longest prefix match for the destination IP address.
When a router receives a packet, it compares the destination IP against all entries in its routing table. The fundamental rule for packet forwarding is Longest Prefix Match (LPM). Among all matching routes for 192.168.1.138, the route 192.168.1.136/29 has the longest subnet mask (/29 vs /26, /25, /24). Therefore, administrative distance and metrics are ignored, and the router selects next-hop 10.0.0.4 via GigabitEthernet0/0/4.
Adım Adım Çözüm
Anahtar Kavram
Router Forwarding Decision Logic and Longest Prefix Match (LPM)