A Cisco router receives an IP packet destined for host 172.20.16.68. The network engineer checks the routing table and observes the following entries:
text
C 172.20.16.0/23 is directly connected, GigabitEthernet0/0/0
S 172.20.16.0/25 [1/0] via 192.168.1.1, GigabitEthernet0/0/1
D 172.20.16.64/27 [90/2570240] via 192.168.1.5, GigabitEthernet0/0/2
O 172.20.16.64/28 [110/30] via 192.168.1.9, GigabitEthernet0/0/3
Which next-hop IP address and outgoing interface will the router select to forward this packet?
- Next-hop 192.168.1.9 via GigabitEthernet0/0/3Cevap
- BNext-hop 192.168.1.1 via GigabitEthernet0/0/1
- CNext-hop 192.168.1.5 via GigabitEthernet0/0/2
- DDirectly connected interface GigabitEthernet0/0/0 without a next-hop IP
Cevap
The router will select next-hop 192.168.1.9 via interface GigabitEthernet0/0/3 because the /28 route provides the longest prefix match for destination 172.20.16.68.
When a router performs a destination lookup in the routing table, it evaluates all matching entries and selects the route with the most specific prefix length (Longest Prefix Match). The host address 172.20.16.68 falls within all four candidate subnet ranges, but 172.20.16.64/28 has the highest mask length (/28 > /27 > /25 > /23). Therefore, the router forwards the packet using next-hop 192.168.1.9 via GigabitEthernet0/0/3 regardless of the higher administrative distance of OSPF.
Adım Adım Çözüm
Anahtar Kavram
Longest Prefix Match (LPM) in IP Routing