Router Forwarding Decision Logic

60 questions

Question 1Question

When a router processes an incoming IP packet to make a forwarding decision, it evaluates matching candidate routes using a deterministic precedence hierarchy. Place the following routing decision criteria in the correct order of evaluation from first (1st) to last (4th).

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct sequence for router forwarding decision logic is: 1) Longest prefix match, 2) Administrative distance, 3) Metric, and 4) Equal-cost load balancing.
A router evaluates forwarding decisions using a strict hierarchy: first, it determines the longest prefix match (most specific subnet mask matching the destination IP). If multiple routes have the exact same prefix length, it evaluates Administrative Distance to select the route from the most trustworthy source. If multiple routes come from the same routing source with identical prefix lengths, it compares the Metric to pick the path with the lowest cost. Finally, if prefix length, Administrative Distance, and Metric are all equal, the router performs equal-cost load balancing.

Step-by-Step Solution

1
Evaluate subnet mask specificity for candidate routes matching the destination IP.
Longest prefix match is evaluated first.
The router always prefers the most specific route (longest prefix length) regardless of protocol or AD.
2
Compare routing sources when matching routes have identical prefix lengths.
Administrative Distance (AD) is evaluated second.
Lower AD indicates a more believable/trustworthy routing source (e.g., Static route AD 1 vs OSPF AD 110).
3
Compare route metrics for paths learned via the same routing protocol with identical prefix lengths.
Metric is evaluated third.
Within a single routing protocol, lower metric indicates a lower-cost, more efficient network path.
4
Handle remaining candidate routes where prefix length, AD, and metric are all identical.
Equal-cost load balancing is applied fourth.
When all criteria are tied, the router installs multiple next-hops into the forwarding table for traffic sharing.

Key Concept

Router Forwarding Precedence Hierarchy
Question 2Question

Refer to the following routing table output from a Cisco router:

Codes: C - connected, S - static, R - RIP, O - OSPF
Gateway of last resort is not set

10.0.0.0/8 is subnetted, 4 subnets
O 10.1.1.0/24 [110/20] via 192.168.1.2, 00:04:12, GigabitEthernet0/0
S 10.1.0.0/16 [1/0] via 192.168.1.1, GigabitEthernet0/1
O 10.1.1.128/25 [110/30] via 192.168.1.3, 00:02:15, GigabitEthernet0/2
S* 0.0.0.0/0 [1/0] via 192.168.1.254

When the router receives a packet destined for host 10.1.1.130, which next-hop IP address will the router use to forward the packet?

Show answer & explanation

Answer: 192.168.1.3

Answer

The router will forward the packet to next-hop 192.168.1.3.
When a router makes a forwarding decision, it evaluates all routes in the routing table that cover the destination address and selects the one with the longest prefix mask (most specific match). Destination host 10.1.1.130 matches 10.1.0.0/16, 10.1.1.0/24, and 10.1.1.128/25. The route 10.1.1.128/25 is the most specific match with 25 matching bits, so the router forwards the packet to its next-hop IP address, 192.168.1.3.

Step-by-Step Solution

1
Identify all matching routes for destination IP address 10.1.1.130.
Matching routes are 10.1.0.0/16, 10.1.1.0/24, 10.1.1.128/25, and 0.0.0.0/0.
10.1.1.130 falls within the range of 10.1.0.0–10.1.255.255 (/16), 10.1.1.0–10.1.1.255 (/24), 10.1.1.128–10.1.1.255 (/25), and default route.
2
Compare prefix lengths of all matching routes to determine the Longest Prefix Match (LPM).
10.1.1.128/25 has a 25-bit subnet mask, which is longer than /24, /16, and /0.
The router always prefers the route with the most specific (longest) prefix match before considering Administrative Distance or Metric.
3
Identify the next-hop address associated with the longest prefix match route.
The route 10.1.1.128/25 uses next-hop 192.168.1.3.
The forwarding table specifies via 192.168.1.3 for 10.1.1.128/25.

Key Concept

Longest Prefix Match (LPM) Rule
Estimated Time:1m 0s
Question 3Question

Refer to the exhibit displaying an abbreviated routing table for router R1:

text
Gateway of last resort is 192.168.4.1 to network 0.0.0.0

S* 0.0.0.0/0 [1/0] via 192.168.4.1, Serial0/0/0
S 10.1.1.0/24 [1/0] via 192.168.1.1, GigabitEthernet0/0
D 10.1.1.64/26 [90/307200] via 192.168.2.1, GigabitEthernet0/1
O 10.1.1.64/28 [110/20] via 192.168.3.1, GigabitEthernet0/2

Router R1 receives an IP packet addressed to destination host 10.1.1.6710.1.1.67. Which next-hop IP address and outbound interface will R1 use to forward this packet?

Show answer & explanation

Answer: 192.168.3.1 via GigabitEthernet0/2

Answer

192.168.3.1 via GigabitEthernet0/2
When forwarding a packet, a router first evaluates all routes in its routing table to find matches for the destination IP address. If multiple routes match, the router strictly enforces the Longest Prefix Match (LPM) rule. For destination IP 10.1.1.67, matching prefixes are /24, /26, and /28. The /28 prefix (10.1.1.64/28) is the longest match. Therefore, R1 forwards the packet to next-hop 192.168.3.1 via interface GigabitEthernet0/2, completely ignoring Administrative Distance when prefix lengths differ.

Step-by-Step Solution

1
Determine subnet ranges for matching routes in the routing table for destination IP 10.1.1.6710.1.1.67
The IP 10.1.1.6710.1.1.67 matches three specific routes: 10.1.1.0/24 (range .0 to .255), 10.1.1.64/26 (range .64 to .127), and 10.1.1.64/28 (range .64 to .79), as well as the default route 0.0.0.0/0.
Before comparing routing protocols or metrics, a router determines which routes encompass the destination IP address.
2
Compare matching prefix lengths to apply the Longest Prefix Match (LPM) rule
Prefix lengths are /24, /26, and /28. The /28 prefix length is the longest (most specific) match.
Cisco routers always prefer the route with the longest matching subnet mask (/28 > /26 > /24 > /0) regardless of Administrative Distance or Metric.
3
Identify the next-hop IP address and egress interface for the winning /28 route
The route `10.1.1.64/28` points to next-hop IP `192.168.3.1` out interface `GigabitEthernet0/2`.
The parameters associated with the longest prefix match determine the forwarding destination for the packet.

Key Concept

Router Forwarding Decision Logic & Longest Prefix Match (LPM)
Estimated Time:1m 30s
Question 4Question

A Cisco router receives an IP packet and initiates a route lookup process to select the optimal path. Arrange the router forwarding decision logic steps in the correct sequential order from first to last.

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct sequence for router forwarding decision logic is: 1) Identify matching routing table entries, 2) Select the route with the Longest Prefix Match, 3) Break ties using Administrative Distance for different sources, 4) Break ties using Metric for identical sources, and 5) Forward the packet using the selected next-hop/exit interface.
The router forwarding process strictly follows a hierarchical evaluation sequence: First, the router checks for matching network entries in the routing table. Second, if multiple matching routes exist, it selects the route with the Longest Prefix Match (LPM), which represents the most specific path. Third, if multiple routes have the exact same prefix length but come from different sources, the router uses Administrative Distance (AD) to select the most reliable source. Fourth, if the prefix length and routing source are the same, the router uses the protocol's Metric to choose the optimal path. Finally, the packet is forwarded out the resulting egress interface to the next-hop IP.

Step-by-Step Solution

1
Scan routing table for matching prefix entries
Candidate routes matching the destination IP address are identified
The router performs a bitwise AND operation on the destination IP with subnet masks in the table to find matches.
2
Apply Longest Prefix Match (LPM) rule
The candidate route with the longest mask length is prioritized above all others
LPM takes precedence over Administrative Distance and Metric regardless of the routing protocol source.
3
Compare Administrative Distance (AD)
Ties between identical prefix lengths from different routing protocols are broken
Lower AD indicates a more believable/trustworthy route source (e.g., Connected=0, Static=1, OSPF=110).
4
Compare Metric values
Ties between identical prefix lengths from the same routing protocol are broken
Protocol-specific metrics (cost, hop count, bandwidth) determine the best path within that specific protocol.
5
Execute packet forwarding
The packet is encapsulated and sent via the designated exit interface or next-hop IP
The decision path concludes with Layer 2 rewrite and transmission.

Key Concept

Cisco Router Forwarding Decision Hierarchy (LPM -> AD -> Metric)
Question 5Question

Refer to the following IPv4 routing table snippet from a Cisco router:

text
Gateway of last resort is 192.168.100.1 to network 0.0.0.0

S 10.20.0.0/16 [1/0] via 192.168.1.1
D 10.20.30.0/24 [90/307200] via 192.168.23.3, GigabitEthernet0/0/2
O 10.20.30.64/27 [110/20] via 192.168.12.2, GigabitEthernet0/0/1
S* 0.0.0.0/0 [1/0] via 192.168.100.1, GigabitEthernet0/0/0

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

Show answer & explanation

Answer: 192.168.12.2

Answer

192.168.12.2
When a router receives a packet, it compares the destination IP address against the routing table entries and selects the route with the longest prefix match (most specific subnet mask). The destination IP address 10.20.30.77 falls within the subnet range 10.20.30.64 to 10.20.30.95 (/27). Among all matching routes (/16, /24, /27, and /0), /27 has the greatest number of matching network bits, making the next-hop IP address 192.168.12.2 the correct forwarding choice.

Step-by-Step Solution

1
Identify all candidate routes that match the destination IP 10.20.30.77.
The IP address 10.20.30.77 falls into three specific route ranges: 10.20.0.0/16, 10.20.30.0/24, and 10.20.30.64/27 (range 10.20.30.64 to 10.20.30.95), plus the default route 0.0.0.0/0.
Routing decision logic requires evaluating all matching entries in the IPv4 routing table.
2
Apply the Longest Prefix Match (LPM) rule to select the route with the longest subnet mask.
Comparing the subnet mask lengths (/16, /24, and /27), the prefix /27 is the longest (most specific) match.
The router always prioritizes prefix length above Administrative Distance or Metric when choosing between matching routes.
3
Determine the next-hop IP associated with the chosen /27 route.
The route O 10.20.30.64/27 specifies next-hop IP 192.168.12.2 via GigabitEthernet0/0/1.
The forward decision routes the packet out the next hop designated by the winning route.

Key Concept

Longest Prefix Match (LPM) Precedence
Question 6Question

A Cisco router receives an IPv4 packet destined for a remote network. Place the router forwarding decision and packet processing steps in the correct chronological order from first to last.

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct order of router forwarding decision logic begins with inspecting the destination IP header, evaluating the routing table using Longest Prefix Match, resolving equal prefix length ties using Administrative Distance and metric, identifying the next-hop IP and exit interface, and performing Layer 2 header rewriting along with TTL decrement prior to frame transmission.
Router forwarding logic follows a deterministic sequence: packet IP inspection -> Longest Prefix Match evaluation -> Administrative Distance/metric tie-breaking for equal prefixes -> next-hop and exit interface resolution -> Layer 2 MAC resolution, TTL decrement, and frame forwarding.

Step-by-Step Solution

1
Examine packet header
Destination IPv4 address is extracted from the incoming packet.
The router requires the destination address to initiate a routing table lookup.
2
Apply Longest Prefix Match rule
The routing table entry with the longest subnet mask matching the destination IP is chosen.
LPM is the primary criterion in Cisco IPv4 forwarding decision logic.
3
Compare Administrative Distance and metric
Ties between identical prefix lengths from different routing sources are resolved.
Administrative Distance ranks route trustworthiness when prefix lengths are equal.
4
Retrieve egress forwarding details
The next-hop IPv4 address and outbound interface are identified.
Forwarding requires knowing where to encapsulate and send the packet next.
5
Execute Layer 2 rewrite and transmission
TTL is decremented by 1, IP header checksum updated, next-hop MAC resolved via ARP, and frame sent.
Layer 2 encapsulation is link-local and must be rewritten for each hop along the path.

Key Concept

Router Forwarding Decision Logic
Question 7Question

Refer to the following excerpt from a Cisco router's IPv4 routing table:

text
Gateway of last resort is 192.168.4.1 to network 0.0.0.0

S 10.1.4.0/24 [1/0] via 192.168.1.1
O 10.1.4.64/27 [110/20] via 192.168.2.1, 00:12:45, GigabitEthernet0/0/2
D 10.1.0.0/16 [90/307200] via 192.168.3.1, 01:45:10, GigabitEthernet0/0/3
S* 0.0.0.0/0 [1/0] via 192.168.4.1

The router receives an IP packet destined for 10.1.4.6710.1.4.67. Which next-hop IP address will the router select to forward this packet?

Show answer & explanation

Answer: 192.168.2.1

Answer

The router forwards the packet to next-hop IP address 192.168.2.1.
The destination IPv4 address 10.1.4.6710.1.4.67 matches multiple routes in the routing table: 10.1.4.0/2410.1.4.0/24, 10.1.4.64/2710.1.4.64/27, 10.1.0.0/1610.1.0.0/16, and 0.0.0.0/00.0.0.0/0. Router forwarding decision logic dictates that the router will ALWAYS prefer the Longest Prefix Match (most specific subnet mask). Comparing mask lengths (/27 > /24 > /16 > /0), the route 10.1.4.64/2710.1.4.64/27 has the longest match. Therefore, the router forwards the packet to next-hop 192.168.2.1192.168.2.1.

Step-by-Step Solution

1
Evaluate all routes matching the destination IP address 10.1.4.67.
Three matching routes found: 10.1.4.0/24 (prefix length 24), 10.1.4.64/27 (prefix length 27), and 10.1.0.0/16 (prefix length 16).
The subnet 10.1.4.64/27 covers IP addresses 10.1.4.64 through 10.1.4.95, which includes 10.1.4.67.
2
Apply the Longest Prefix Match (LPM) rule.
The route 10.1.4.64/27 has a 27-bit mask, which is longer than /24, /16, and /0.
The router always prioritizes the most specific match (longest subnet mask) first before evaluating Administrative Distance.
3
Identify the next-hop IP address for the winning route 10.1.4.64/27.
The next-hop address associated with 10.1.4.64/27 is 192.168.2.1.
The routing table entry specifies 'via 192.168.2.1'.

Key Concept

Router Forwarding Decision Logic (Longest Prefix Match)
Question 8Question

Refer to the following routing table snippet from a Cisco router:

text
Codes: C - connected, S - static, O - OSPF, D - EIGRP
Gateway of last resort is not set

D 172.16.10.0/24 [90/2172416] via 10.1.1.1, 00:05:12, GigabitEthernet0/0
O 172.16.10.0/26 [110/20] via 10.1.1.2, 00:12:45, GigabitEthernet0/1
S 172.16.0.0/16 [1/0] via 10.1.1.3
C 172.16.10.128/27 is directly connected, GigabitEthernet0/2

When the router receives an IP packet destined for host 172.16.10.33, which next-hop IP address or interface will be selected to forward the packet?

Show answer & explanation

Answer: 10.1.1.2

Answer

10.1.1.2 via GigabitEthernet0/1 based on Longest Prefix Match (/26).
When forwarding IP packets, a router always evaluates candidate routes using Longest Prefix Match (LPM) first. For the target IP address 172.16.10.33, three candidate routes match: 172.16.0.0/16, 172.16.10.0/24, and 172.16.10.0/26. The OSPF route 172.16.10.0/26 provides the longest matching prefix mask (/26), so the router forwards the packet to next-hop IP 10.1.1.2.

Step-by-Step Solution

1
Identify all candidate routes that match destination IP 172.16.10.33.
Three matching routes exist: 172.16.0.0/16, 172.16.10.0/24, and 172.16.10.0/26. The route 172.16.10.128/27 covers range 172.16.10.128 to 172.16.10.159 and does not match.
Routing decision logic only evaluates routes whose network address and subnet mask encompass the target IP.
2
Compare prefix lengths among all matching candidate routes.
172.16.10.0/26 has a 26-bit prefix match, which is longer (more specific) than /24 and /16.
Longest Prefix Match (LPM) is always the primary criterion used by a router when selecting a route from the routing table.
3
Determine the next-hop associated with the longest prefix match route.
The route 172.16.10.0/26 points to next-hop IP 10.1.1.2.
Administrative Distance and Metric are only evaluated when comparing routes with identical prefix lengths from different sources.

Key Concept

Router Forwarding Decision Logic (Longest Prefix Match Precedence)
Question 9Question

When a Cisco router receives an IP packet, it evaluates several parameters to determine the best route to place into the routing decision process. Place the path selection criteria in the correct sequential order, from the primary (first evaluated) factor to the final tie-breaker factor.

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct order of router decision criteria is: 1) Longest Prefix Match, 2) Administrative Distance, 3) Metric, 4) Equal-Cost Multi-Path.
Router forwarding decision logic evaluates parameters in a strict hierarchical order. First, Longest Prefix Match identifies the most specific network prefix for the destination IP address. If multiple routes exist with the exact same prefix length from different protocols, Administrative Distance breaks the tie by choosing the lower value. If multiple candidate routes come from the same routing protocol with identical prefix lengths, the Metric is used as the next tie-breaker. Finally, if prefix length, Administrative Distance, and metric are all identical, Equal-Cost Multi-Path load balancing is performed.

Step-by-Step Solution

1
Determine primary routing lookup criteria
Longest Prefix Match is checked first.
Prefix specificity always takes precedence over AD and metric.
2
Evaluate tie-breaker between different routing protocols for the exact same prefix length
Administrative Distance is compared.
Lower AD indicates a more trustworthy routing source.
3
Evaluate tie-breaker within the same routing protocol
Metric is compared.
Lower metric indicates a lower internal routing protocol cost.
4
Handle identical tie-breaker results
Equal-Cost Multi-Path load balancing is applied.
When all parameters match identically, the router balances traffic across the equal routes.

Key Concept

Router Forwarding Decision Logic Sequence
Question 10Question

A Cisco router receives an IP packet destined for 10.20.12.15010.20.12.150. Refer to the following routing table output:

text
Codes: C - connected, S - static, D - EIGRP, O - OSPF

Gateway of last resort is 10.1.1.1 to network 0.0.0.0

D 10.20.0.0/14 [90/2172416] via 192.168.1.2, GigabitEthernet0/1
O 10.20.12.0/22 [110/20] via 192.168.1.6, GigabitEthernet0/2
S 10.20.12.0/24 [1/0] via 192.168.1.10, GigabitEthernet0/3
O 10.20.12.128/25 [110/30] via 192.168.1.14, GigabitEthernet0/4
S* 0.0.0.0/0 [1/0] via 10.1.1.1, GigabitEthernet0/0

Which next-hop IP address will the router select to forward this packet?

Show answer & explanation

Answer: 192.168.1.14

Answer

The router forwards the packet to next-hop IP 192.168.1.14 because the route 10.20.12.128/25 has the longest prefix match for destination 10.20.12.150.
When forwarding IP packets, a Cisco router always prioritizes the route with the Longest Prefix Match (most specific subnet mask). The destination address 10.20.12.150 falls within the range 10.20.12.128 to 10.20.12.255 defined by 10.20.12.128/25. Because /25 is more specific than /24, /22, /14, or /0, the router uses this route, which forwards to next-hop 192.168.1.14.

Step-by-Step Solution

1
Identify all candidate routes that encompass the destination IP address 10.20.12.150.
Candidate routes are 10.20.0.0/14, 10.20.12.0/22, 10.20.12.0/24, 10.20.12.128/25, and 0.0.0.0/0.
The router evaluates destination IP bit alignment against subnet masks of all known routes.
2
Compare the prefix lengths of all matching candidate routes.
Prefix lengths are /14, /22, /24, /25, and /0. The route 10.20.12.128/25 has the longest prefix mask (/25).
Routers use the Longest Prefix Match (LPM) logic first before considering Administrative Distance or Metric.
3
Select the next-hop IP associated with the longest prefix match route.
The route 10.20.12.128/25 points to next-hop 192.168.1.14.
Longest prefix match determines the exact routing entry used for forwarding.

Key Concept

Longest Prefix Match (LPM) precedence in IP forwarding decision logic.
Question 11Question

A Cisco router receives an IPv4 unicast packet destined for 10.150.45.6710.150.45.67. The router's Routing Information Base (RIB) and Forwarding Information Base (FIB) contain multiple overlapping routes, static entries, and dynamic routing protocol paths. In what exact sequence does the router evaluate routing parameters and process the packet from ingress lookup to physical egress forwarding? Arrange the steps in the correct chronological order from first to last.

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct evaluation sequence for router forwarding decision logic is: 1) Longest Prefix Match evaluation, 2) Administrative Distance tie-breaking for identical prefixes across different protocols, 3) Metric tie-breaking for identical prefixes within the same protocol, 4) ARP lookup for next-hop MAC address resolution, and 5) Layer 2 encapsulation rewrite, TTL decrement, checksum update, and frame transmission.
The router forwarding process follows a strict hierarchy: Longest Prefix Match (LPM) is evaluated first across all routes in the routing table. If multiple routes from different protocol sources share the exact same prefix length, Administrative Distance (AD) breaks the tie. If multiple routes from the same protocol share the exact same prefix length, protocol metric breaks the tie. Once the best route and next-hop are chosen, the router resolves the next-hop MAC via ARP/NDP, updates IP header fields (TTL decrement by 1 and checksum update), rewrites the Layer 2 header, and transmits the frame out the egress interface.

Step-by-Step Solution

1
Perform destination IP lookup using Longest Prefix Match (LPM).
The router identifies all matching subnet routes and selects the route entry with the highest number of matching network bits (most specific mask length).
LPM supersedes lower Administrative Distance values or routing metrics. A /28/28 route will always be chosen over a /24/24 route regardless of whether the /24/24 is static or connected.
2
Compare Administrative Distance (AD) if multiple sources present identical prefix masks.
The route from the source with the lowest AD (e.g., Static 11 vs. OSPF 110110) is preferred.
AD measures route source believability and only arbitrates between identical prefix masks from different routing processes.
3
Compare routing protocol metrics for ties within the same protocol.
The path with the lowest metric (cost, hop count, composite metric) is selected for RIB insertion.
Metrics only compare routes of the exact same prefix length learned via the same routing protocol algorithm.
4
Perform Layer 2 address resolution for the resolved next-hop address.
The router locates the next-hop IPv4 address in the ARP cache to retrieve its target MAC address.
Layer 3 forwarding decision requires binding the IP next-hop to a physical Layer 2 destination MAC address.
5
Execute packet header modifications and physical transmission.
The IPv4 TTL is decremented by 11, header checksum recalculated, source MAC updated to egress interface MAC, destination MAC updated to next-hop MAC, and the frame is serialized onto the wire.
Routers act as Layer 3 boundaries and must rebuild the Layer 2 frame header for each routed hop.

Key Concept

Router Forwarding Decision Logic and Longest Prefix Match Hierarchical Precedence
Question 12Question

Refer to the following partial routing table output from a Cisco router:

text
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

Gateway of last resort is 10.4.4.4 to network 0.0.0.0

O 172.16.32.0/20 [110/20] via 10.1.1.1, 00:10:05, GigabitEthernet0/0
D 172.16.35.64/28 [90/307200] via 10.2.2.2, 00:05:12, GigabitEthernet0/1
S 172.16.35.64/26 [1/0] via 10.3.3.3
C 172.16.35.0/24 is directly connected, GigabitEthernet0/2
S* 0.0.0.0/0 [1/0] via 10.4.4.4

The router receives an ingress IPv4 packet with a destination address of 172.16.35.73. Which statements accurately describe the router forwarding decision for this packet? (Select TWO.)

Select all that apply

Show answer & explanation

Answer: The router forwards the packet to next-hop IP 10.2.2.2 via GigabitEthernet0/1 because the route to 172.16.35.64/28 provides the longest prefix match.; The router bypasses the static route to 172.16.35.64/26 despite its lower Administrative Distance because Administrative Distance is only compared among routes with identical prefix lengths.

Answer

The router forwards the packet to next-hop IP 10.2.2.2 via GigabitEthernet0/1 because 172.16.35.64/28 is the longest prefix match, and it ignores lower administrative distances on shorter prefixes because AD is only evaluated when prefix lengths are equal.
When forwarding an IPv4 packet, a Cisco router evaluates the Forwarding Information Base using Longest Prefix Match (LPM) as the primary criteria. For destination address 172.16.35.73, the route 172.16.35.64/28 (host range 172.16.35.64 to 172.16.35.79) has a 28-bit prefix length, making it more specific than the /26 static route, the /24 directly connected subnet, or the /20 OSPF route. Administrative Distance (AD) is only evaluated when multiple routing protocols install identical network prefixes into the routing table, so the router does not consider the lower AD of the static route.

Step-by-Step Solution

1
Identify all candidate routes matching destination IP 172.16.35.73
Candidate routes are 172.16.32.0/20, 172.16.35.0/24, 172.16.35.64/26, 172.16.35.64/28, and 0.0.0.0/0.
The destination host IP 172.16.35.73 falls within the IP address range of all these configured route subnets.
2
Determine the Longest Prefix Match (LPM) among candidates
172.16.35.64/28 has the longest prefix mask length (/28 = 28 bits).
Cisco IOS forwarding logic always selects the route with the most specific subnet mask matching the target destination.
3
Evaluate Administrative Distance and Metric applicability
Administrative Distance and Metric are not compared across different prefix lengths.
AD is only used when multiple routing protocols offer routes to the exact same network prefix length.

Key Concept

Router Forwarding Decision Logic (Longest Prefix Match Rule)
Question 13Question

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
O 172.16.0.0/16 [110/50] via 10.1.1.1, 01:14:22, GigabitEthernet0/0/1
D 172.16.35.0/24 [90/2172416] via 10.2.2.2, 00:42:10, GigabitEthernet0/0/2
S 172.16.35.32/27 [1/0] via 10.3.3.3
O 172.16.35.40/29 [110/30] via 10.4.4.4, 00:08:15, GigabitEthernet0/0/3

A packet with a destination IP address of 172.16.35.42172.16.35.42 arrives at the router. Which two statements correctly describe how the router makes its forwarding decision for this packet? (Select two.)

Select all that apply

Show answer & explanation

Answer: The router forwards the packet to next-hop 10.4.4.4 because 172.16.35.40/29 provides the longest matching prefix for the destination address.; Administrative distance is evaluated only after the router identifies all candidate routes that share the longest matching prefix length.

Answer

The router forwards the packet to next-hop 10.4.4.4 because 172.16.35.40/29 is the longest matching prefix, and administrative distance is evaluated only after determining candidate routes with the longest matching prefix length.
When a router receives a packet, it compares the destination IP against all entries in its routing table and selects the entry with the longest prefix match (most specific mask). Here, 172.16.35.40/29 matches 29 bits of the destination address 172.16.35.42, making it more specific than the /27 static route or /24 EIGRP route. Administrative distance is only evaluated when choosing among routes with identical prefix lengths.

Step-by-Step Solution

1
Evaluate all routes matching the destination IP address 172.16.35.42.
Matching routes: 0.0.0.0/0 (/0), 172.16.0.0/16 (/16), 172.16.35.0/24 (/24), 172.16.35.32/27 (/27), and 172.16.35.40/29 (/29).
The destination address 172.16.35.42 resides within the IP range 172.16.35.40 to 172.16.35.47 defined by the /29 subnet mask.
2
Apply the Longest Prefix Match (LPM) rule.
The route 172.16.35.40/29 has a 29-bit mask, which is longer than /27, /24, /16, or /0.
Routers always prefer the route with the most specific (longest) subnet mask first, before considering administrative distance or metric.
3
Verify if 172.16.35.42 is a valid unicast host IP in 172.16.35.40/29.
Subnet ID: 172.16.35.40, Usable hosts: 172.16.35.41 - 172.16.35.46, Broadcast: 172.16.35.47.
172.16.35.42 is a valid host address, so the packet is forwarded to next-hop 10.4.4.4 via GigabitEthernet0/0/3.

Key Concept

Longest Prefix Match (LPM) Rule in Cisco IPv4 Forwarding Logic
Estimated Time:1m 30s
Question 14Question

Refer to the following routing table output from a Cisco router:

text
Codes: C - connected, S - static, O - OSPF, D - EIGRP

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O 10.1.0.0/16 [110/20] via 192.168.1.2, 00:05:12, GigabitEthernet0/0
D 10.1.4.0/22 [90/307200] via 192.168.1.6, 00:12:33, GigabitEthernet0/1
S 10.1.4.0/24 [1/0] via 192.168.1.10, 01:45:00, GigabitEthernet0/2
O 10.1.4.128/25 [110/10] via 192.168.1.14, 00:02:15, GigabitEthernet0/3

A packet arrives at the router with a destination IP address of 10.1.4.13010.1.4.130. Which exit interface will the router use to forward this packet?

Show answer & explanation

Answer: GigabitEthernet0/3, because the route to 10.1.4.128/25 has the longest matching prefix length for the destination IP address.

Answer

The router forwards the packet out interface GigabitEthernet0/3 because 10.1.4.128/25 is the longest prefix match for destination 10.1.4.130.
When a router receives an IP packet, it compares the destination IP address against all entries in its routing table. The fundamental rule of IP route selection is Longest Prefix Match (LPM). Since 10.1.4.130 matches 10.1.4.128/25 (/25 bit match), 10.1.4.0/24 (/24 bit match), 10.1.4.0/22 (/22 bit match), and 10.1.0.0/16 (/16 bit match), the router selects 10.1.4.128/25 because /25 is the longest (most specific) prefix length. Consequently, traffic is forwarded via GigabitEthernet0/3.

Step-by-Step Solution

1
Identify candidate routes matching destination IP 10.1.4.130.
The candidate routes are: 10.1.0.0/16, 10.1.4.0/22, 10.1.4.0/24, and 10.1.4.128/25.
All four routes contain IP address 10.1.4.130 within their range.
2
Determine the prefix length for each matching candidate route.
Prefix lengths are /16, /22, /24, and /25.
Longest Prefix Match (LPM) rule dictates that the route with the most specific subnet mask (highest prefix number) is selected first.
3
Select the route with the longest prefix match.
10.1.4.128/25 (/25) is the longest match, which forwards out GigabitEthernet0/3.
Administrative Distance (AD) and metric are ignored when prefix lengths differ among candidate routes.

Key Concept

Router Forwarding Decision Logic (Longest Prefix Match precedence over Administrative Distance and Metric)
Question 15Question

Examine the following Cisco router IP routing table output:

text
R1# show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

Gateway of last resort is not set

172.24.0.0/16 is subnetted, 4 subnets
S 172.24.0.0/16 [1/0] via 10.10.10.1
D 172.24.16.0/24 [90/307200] via 10.10.20.1
O 172.24.16.64/26 [110/40] via 10.10.30.1
R 172.24.16.80/28 [120/2] via 10.10.40.1

Router R1 receives an IP packet destined for 172.24.16.85172.24.16.85. Which next-hop IP address will router R1 select to forward this packet?

Show answer & explanation

Answer: 10.10.40.1

Answer

10.10.40.1
When a router makes a forwarding decision, it evaluates matching routes using Longest Prefix Match (LPM) as the top priority criterion. Because 172.24.16.85172.24.16.85 matches 172.24.16.80/28172.24.16.80/28 (range .80–.95), the /28/28 route has the longest prefix length (28 bits) among all candidates. Thus, next-hop 10.10.40.1 is selected regardless of RIP having a higher Administrative Distance (120) than Static (1), EIGRP (90), or OSPF (110).

Step-by-Step Solution

1
Determine which routing table entries match the target destination IP 172.24.16.85172.24.16.85.
Matches found: 172.24.0.0/16172.24.0.0/16, 172.24.16.0/24172.24.16.0/24, 172.24.16.64/26172.24.16.64/26 (range .64 to .127), and 172.24.16.80/28172.24.16.80/28 (range .80 to .95).
The destination address 172.24.16.85172.24.16.85 falls within the address ranges of all four configured subnets.
2
Apply the router forwarding lookup order logic (Longest Prefix Match).
The /28/28 prefix is selected over /26/26, /24/24, and /16/16 because 2828 is the maximum number of matching prefix bits.
Routers always evaluate prefix length first. Administrative Distance is only evaluated when comparing identical prefixes learned from different sources.
3
Identify the next-hop IP associated with the winning /28/28 route entry.
The next-hop address for 172.24.16.80/28172.24.16.80/28 is 10.10.40.110.10.40.1.
The packet is forwarded out to the next hop specified in the /28/28 RIP route entry despite its higher AD.

Key Concept

Longest Prefix Match (LPM) precedence in Cisco IPv4 routing lookup decision logic
Estimated Time:2m 0s
Question 16Question

A Cisco router receives an IP packet destined for host 172.16.35.67172.16.35.67. The routing table contains multiple candidate routes that match this destination IP address. Place the routing decision criteria in the correct order of precedence used by the router to make its forwarding decision, from first evaluated (highest precedence) at the top to last evaluated (lowest precedence) at the bottom.

Drag items to arrange them in the correct order

Show answer & explanation

Answer

The correct sequence of router forwarding decision logic criteria from highest to lowest precedence is: 1) Longest Prefix Match, 2) Lowest Administrative Distance, 3) Lowest Metric, and 4) Equal-Cost Load Balancing.
When forwarding an IP packet, a Cisco router evaluates candidate routes in a strict multi-tier hierarchy. First, Longest Prefix Match (LPM) determines the best route by selecting the entry with the most specific subnet mask. Second, if multiple routes match with the exact same subnet mask length, the router compares Administrative Distance (AD) to select the most trustworthy route source. Third, if routes share the exact same prefix length and come from the same routing protocol, the router selects the path with the lowest metric. Finally, if prefix length, AD, and metric are all identical, equal-cost load balancing is applied.

Step-by-Step Solution

1
Evaluate mask length specificity (Longest Prefix Match).
The router compares the destination address against all routing table entries and isolates candidate routes matching the highest number of left-to-right network bits (longest subnet mask).
Longest Prefix Match is the primary decision rule in IP packet forwarding and overrides AD and metric.
2
Compare Administrative Distance (AD) for identical prefix lengths.
If candidate routes share the exact same prefix length (e.g., two /24/24 routes), the router compares route sources and selects the one with the lowest AD value.
Administrative Distance defines the believability or trustworthiness of the route source.
3
Compare routing protocol Metric for identical prefix length and route source.
If multiple candidate routes share the exact same prefix length and originate from the same routing protocol (same AD), the router selects the path with the lowest metric value.
Metric measures the cost or desirability of a specific path within a routing protocol domain.
4
Execute Equal-Cost Multi-Path (ECMP) load balancing.
If candidate routes for the exact same prefix length have identical AD and metric values, the router installs multiple paths in the Forwarding Information Base (FIB) and distributes traffic across them.
Equal-cost load balancing optimizes link usage when multiple best paths exist.

Key Concept

Router Forwarding Decision Hierarchy (LPM -> AD -> Metric -> ECMP)
Estimated Time:2m 0s
Question 17Question

Refer to the following Cisco CLI routing table output:

text
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

Gateway of last resort is not set

S 172.31.50.0/24 [1/0] via 10.1.1.1, GigabitEthernet0/0/1
D 172.31.50.64/28 [90/307200] via 10.2.2.2, GigabitEthernet0/0/2
O 172.31.50.64/29 [110/20] via 10.3.3.3, GigabitEthernet0/0/3
R 172.31.50.68/30 [120/1] via 10.4.4.4, GigabitEthernet0/0/4

A router receives an IP packet addressed to 172.31.50.67172.31.50.67. Which next-hop IP address will the router select to forward this packet?

Show answer & explanation

Answer: 10.3.3.3

Answer

The router forwards the packet to next-hop IP address 10.3.3.3 via interface GigabitEthernet0/0/3.
The correct choice identifies 10.3.3.3 as the next hop because the route 172.31.50.64/29 has the longest matching prefix (/29) among all valid candidate routes covering destination IP 172.31.50.67. A router always prefers the most specific route (longest prefix length) regardless of Administrative Distance or metric.

Step-by-Step Solution

1
Evaluate the target destination IP against all candidate routes in the routing table.
Destination IP 172.31.50.67172.31.50.67 is checked against each prefix mask.
The router must first find all matching subnets.
2
Determine subnet boundaries for candidate routes.
- 172.31.50.0/24 covers 172.31.50.0 to 172.31.50.255 (Match, length /24)
- 172.31.50.64/28 covers 172.31.50.64 to 172.31.50.79 (Match, length /28)
- 172.31.50.64/29 covers 172.31.50.64 to 172.31.50.71 (Match, length /29)
- 172.31.50.68/30 covers 172.31.50.68 to 172.31.50.71 (No match, 67 is outside range)
Routes must cover the target address to be valid candidates.
3
Apply the Longest Prefix Match (LPM) rule among all valid candidate routes.
The valid matching prefixes are /24, /28, and /29. The longest prefix match is /29 (172.31.50.64/29).
Longest Prefix Match is the absolute first criterion used by a router when forwarding packets, taking precedence over Administrative Distance and Metric.
4
Identify the next-hop IP address for the longest prefix match route.
The route 172.31.50.64/29 specifies next-hop IP 10.3.3.3.
Packets are forwarded to the next-hop specified by the winning route.

Key Concept

Longest Prefix Match (LPM) Logic
Question 18Question

Refer to the following 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
D 172.31.0.0/16 [90/2172416] via 10.1.1.1, 01:24:12, GigabitEthernet0/0
O 172.31.45.0/24 [110/20] via 10.2.2.2, 00:45:10, GigabitEthernet0/1
S 172.31.45.128/26 [1/0] via 10.3.3.3
D 172.31.45.128/27 [90/307200] via 10.4.4.4, 02:11:05, GigabitEthernet0/2

The router receives an IP packet with a destination address of 172.31.45.138172.31.45.138. Which next-hop IP address will the router choose to forward this packet?

Show answer & explanation

Answer: 10.4.4.4

Answer

The router will forward the packet to next-hop IP address 10.4.4.4.
When forwarding a packet, a Cisco router compares the destination IP address against all network entries in the routing table and selects the route with the longest prefix match (the most specific subnet mask). The destination address 172.31.45.138 matches 172.31.45.128/27 (host range .128–.159), which has a 27-bit mask length. This is more specific than the /26, /24, /16, or default /0 routes. Therefore, the router forwards the packet to next-hop 10.4.4.4 via GigabitEthernet0/2.

Step-by-Step Solution

1
Determine which routing entries encompass the destination IP address 172.31.45.138.
The destination address 172.31.45.138 falls within the ranges for 0.0.0.0/0, 172.31.0.0/16, 172.31.45.0/24, 172.31.45.128/26 (range 172.31.45.128 to 172.31.45.191), and 172.31.45.128/27 (range 172.31.45.128 to 172.31.45.159).
A router evaluates all matching routes in its routing table before selecting the forwarding path.
2
Apply the Longest Prefix Match (LPM) rule among all valid matching routes.
Prefix lengths are /0, /16, /24, /26, and /27. The route with the longest prefix length is 172.31.45.128/27.
Routers always prioritize the most specific route (longest subnet mask / prefix length) regardless of administrative distance or metric.
3
Identify the next-hop IP associated with the winning route 172.31.45.128/27.
The route specifies 'via 10.4.4.4, GigabitEthernet0/2'.
The packet must be forwarded to the next-hop interface/IP designated by the longest matching routing table entry.

Key Concept

Longest Prefix Match (LPM) precedence in router forwarding logic
Question 19Question

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?

Show answer & explanation

Answer: 10.0.0.4

Answer

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.

Step-by-Step Solution

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.

Key Concept

Router Forwarding Decision Logic & Longest Prefix Match
Question 20Question

Refer to the following partial output from a Cisco router's routing table:

text
Codes: C - connected, S - static, O - OSPF, D - EIGRP

O 172.16.10.0/24 [110/20] via 10.1.1.1, GigabitEthernet0/0
D 172.16.10.64/26 [90/307200] via 10.1.1.2, GigabitEthernet0/1
S 172.16.10.64/27 [1/0] via 10.1.1.3, GigabitEthernet0/2

The router receives an IP packet with a destination IP address of 172.16.10.68. Which statements correctly describe how the router handles this forwarding decision? (Select TWO.)

Select all that apply

Show answer & explanation

Answer: The router selects the static route to 172.16.10.64/27 because it has the longest prefix match for the destination address.; The packet is forwarded out interface GigabitEthernet0/2 toward next-hop IP address 10.1.1.3.

Answer

The router selects the static route to 172.16.10.64/27 because it has the longest prefix match, and forwards the packet out GigabitEthernet0/2 toward next-hop 10.1.1.3.
When forwarding a packet, a router compares the destination IP address against all known routes and chooses the entry with the longest prefix match (most specific netmask). The subnet 172.16.10.64/27 has a 27-bit mask, making it the longest match among the candidates. Consequently, the router routes the packet out GigabitEthernet0/2 to next-hop 10.1.1.3.

Step-by-Step Solution

1
Evaluate destination host IP against candidate subnet ranges in the routing table.
Destination 172.16.10.68 matches 172.16.10.0/24, 172.16.10.64/26, and 172.16.10.64/27.
All three routes encompass the target address within their subnet ranges.
2
Apply the Longest Prefix Match (LPM) rule.
172.16.10.64/27 has a 27-bit mask, which is longer than /26 and /24.
Routers always prefer the route with the most specific (longest) subnet mask first, regardless of administrative distance or metric.
3
Determine the forwarding action based on the selected route entry.
The route specifies exit interface GigabitEthernet0/2 and next-hop 10.1.1.3.
The router forwards the packet using the egress interface and next-hop associated with the winning LPM route.

Key Concept

Router Forwarding Decision Logic & Longest Prefix Match
Page 1 / 3Next
Router Forwarding Decision Logic Practice Questions — Cisco CCNA | Examkin