How does a router choose the best path when multiple routing protocols provide a route to the same destination?
When a router receives multiple routes to the same destination from different routing protocols, it follows a systematic process to select the best path to install in its routing table and use for forwarding traffic.
Step-by-step: How a Router Chooses the Best Path
1. Administrative Distance (AD) Check
-
The router first compares the Administrative Distance of each route.
-
The route with the lowest AD (most trusted source) wins.
Routing Source | Default AD |
---|---|
Connected interface | 0 |
Static route | 1 |
EIGRP (internal) | 90 |
OSPF | 110 |
RIP | 120 |
External EIGRP | 170 |
Example: If OSPF and RIP both have routes to the same network, the router picks the OSPF route (AD 110 < 120).
2. Metric Comparison Within the Same Protocol
-
If multiple routes to the destination come from the same routing protocol and have the same AD, the router uses the routing metric to choose the best path.
-
Metrics vary by protocol:
-
OSPF: Cost (based on bandwidth)
-
RIP: Hop count
-
EIGRP: Composite metric (bandwidth, delay, reliability, load)
-
-
Lower metric means better path.
3. Equal-Cost Multi-Path (ECMP)
-
If multiple routes have equal AD and equal metrics, the router may install multiple routes (load balancing).
-
This is called ECMP, which allows traffic to be spread across multiple best paths.
4. Tie-Breakers (Protocol-Specific)
-
If routes have the same AD and metric, some protocols have additional tie-breakers, such as:
-
Router ID (lowest wins)
-
Path age
-
IP address of next hop
-
Summary Flowchart:
Example
A router learns about network 192.168.1.0/24
from:
-
Static route (AD 1, metric N/A)
-
OSPF route (AD 110, cost 20)
-
RIP route (AD 120, hop count 3)
Router chooses the static route because it has the lowest AD (1), even though the OSPF route may have a better metric.