Soru

Zorluk: OrtaRouter Forwarding Decision Logic

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, 5d12h, GigabitEthernet0/0/0
S 10.200.0.0/16 [1/0] via 192.168.14.2, 3d02h, GigabitEthernet0/0/3
D 10.200.45.0/24 [90/307200] via 192.168.13.2, 00:15:30, GigabitEthernet0/0/2
O 10.200.45.64/29 [110/20] via 192.168.12.2, 00:04:12, GigabitEthernet0/0/1

The router receives a packet with a destination IP address of 10.200.45.6810.200.45.68. Which next-hop IP address and outbound interface will the router select to forward this packet?

  1. 192.168.12.2 via GigabitEthernet0/0/1Cevap
  2. B
    192.168.14.2 via GigabitEthernet0/0/3
  3. C
    192.168.13.2 via GigabitEthernet0/0/2
  4. D
    192.168.1.1 via GigabitEthernet0/0/0

Cevap

The router forwards the packet to next-hop IP 192.168.12.2 via GigabitEthernet0/0/1.
When a router receives a packet, it compares the destination IP against all entries in its IP routing table and selects the match with the longest subnet mask (Longest Prefix Match). The subnet 10.200.45.64/29 covers IP addresses 10.200.45.64 through 10.200.45.71, which includes host 10.200.45.68. Because /29 is more specific than /24, /16, or /0, the router chooses next-hop 192.168.12.2 via GigabitEthernet0/0/1.

Adım Adım Çözüm

1
Identify all candidate routes that match destination IP 10.200.45.68
Matching routes: 0.0.0.0/0 (matches all), 10.200.0.0/16 (range 10.200.0.0-10.200.255.255), 10.200.45.0/24 (range 10.200.45.0-10.200.45.255), and 10.200.45.64/29 (range 10.200.45.64-10.200.45.71).
Before comparing administrative distance, the router identifies all routes whose network/prefix bounds contain the target IP.
2
Apply the Longest Prefix Match (LPM) rule across candidate routes
Prefix lengths are /0, /16, /24, and /29. The longest prefix match is /29.
The router always prioritizes the route with the most specific prefix (highest number of network bits).
3
Select the forwarding decision based on the winning route entry
The route for 10.200.45.64/29 points to next-hop 192.168.12.2 via interface GigabitEthernet0/0/1.
Administrative Distance is not evaluated across different prefix lengths, so the OSPF route /29 wins outright.

Anahtar Kavram

Longest Prefix Match Rule in Cisco IPv4 Forwarding Logic
Bu soruyu puanla