I'm a little confused. I know how the best route makes it to the routing table, but what process does the router follow to choose a path to forward a packet if, for example, you have something like this:

O [110/1] via ...
D [90/2172416] via
S [1/0] via
R [120/1] via

Does the router choose the longest match regardless of the AD of the routing protocols?

3 Answers 3


Routers route packets by what is in the routing table, and identical routes will have the one with the best (lowest) AD make it into the routing table, but the other identical routes will not. Then it is checked for the longest match with the routes in the routing table.

AD determines what makes it into the routing table, and the logest match in the routing table determines which route from the routing table is used.


if multiple route entries are present in router for same destination with different routing protocol means with administrative distance value (AD) value . Lowest the AD value have more priority to choose route entry

Layers 3 devices chooses routing protocols considering AD value (administrative distance) lesser the AD value have more priority for choose routing protocol by Layer3 devices when more than one routing protocol is configured

Default Adminstrative value of routing protocols

Directly connected route => 0

Static routing protocol => 1

RIP ===============>>120

EIGRP ==============>>90

OSPF =≠=============>> 110

Lesser the AD value more priority to choose routing protocol by layer3 devices

For example

If Layer3 devices is configured with RIP and OSPF routing protocols advertising same route to same destination . Layer 3 devices use OSPF routing protocols advertise route details for passing traffic because OSPF routing protocols AD value is less than RIP

We even have feasible to changes default AD values of routing protocols according to our requirements


Longest match is what determines which route is taken. In other words, the most specific route wins every time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.