How a Router Makes a Forwarding Decision by Default.

By | July 5, 2024

A router uses a systematic process to determine the best route for forwarding a data packet. This process involves several key factors: longest match, administrative distance, and routing protocol metric. Below is a detailed explanation of each factor and how they contribute to the routing decision:

1. Longest Match

The longest match principle means that the router selects the route with the most specific match to the destination IP address. This is determined by the subnet mask.

83% discount on VPN

Process:

When a router receives a data packet, it examines the destination IP address. It then compares this IP address against its routing table, looking for entries that match the destination address.

The router considers the subnet masks of these entries and selects the route with the longest subnet mask that matches the destination IP address. This is because a longer subnet mask indicates a more specific network or subnetwork.

Example:

If the destination IP is 192.168.1.10 and the routing table has the following entries:

192.168.0.0/16

192.168.1.0/24

192.168.1.0/25

The router will choose 192.168.1.0/25 as it has the longest match (25 bits).

2. Administrative Distance

Administrative distance (AD) is a measure of the reliability of a route, with lower values being more preferred. It helps the router choose between routes learned from different routing protocols.

Default Administrative Distances:

Directly connected interface: 0

Static route: 1

EIGRP (Enhanced Interior Gateway Routing Protocol): 90

OSPF (Open Shortest Path First): 110

RIP (Routing Information Protocol): 120

External EIGRP: 170

Process:

When multiple routes to the same destination are available from different routing protocols, the router compares their administrative distances.

It selects the route with the lowest administrative distance as the preferred route.

Example:

If a route to the network 10.1.1.0/24 is learned via OSPF (AD 110) and via EIGRP (AD 90), the router will choose the EIGRP route because it has a lower administrative distance.

3. Routing Protocol Metric

A routing protocol metric is a value used by routing protocols to rank routes to a destination within the same routing protocol. Different protocols use different metrics.

Examples of Metrics:

RIP uses hop count (number of routers a packet passes through).

OSPF uses cost, based on link speed.

EIGRP uses a composite metric, considering bandwidth, delay, load, and reliability.

Process:

Once routes are selected based on the longest match and administrative distance, the router then considers the metric within the same routing protocol.

It chooses the route with the lowest metric value as the best path.

Example:

For network 192.168.2.0/24, if two OSPF routes exist:

Route A with cost 10

Route B with cost 20

The router will choose Route A due to its lower cost.

Summary of Decision-Making Process

Longest Match Evaluation:

The router initially looks at the longest match in the routing table for the destination IP.

Administrative Distance Check:

If multiple routes exist with the same longest match, the router compares the administrative distances of these routes.

It selects the route with the lowest administrative distance.

Routing Protocol Metric Comparison:

If there are multiple routes with the same administrative distance, the router evaluates the routing protocol metrics.

The route with the lowest metric is chosen as the best route.

By combining these factors, the router ensures that data packets are forwarded using the most efficient and reliable path available. This hierarchical decision-making process enhances the overall stability and performance of the network.