One of my team member was asking me the question on routing decision. I thought of putting up here ..Any routing decision is based on the following rules.
1) Longest prefix length :- If we have two different routes in a routing table for a same network, the longest prefix match is selected. lets say we have both 172.16.0.0/16 & 172.16.16.0/24 in the routing table. In this case 172.16.16.0/24 will be selected.
2) AD ( Administrative distance) :- If longest prefix match cannot be considered for example if we have two routes with same prefix length then Route with lowest AD will be considered. Incase we have a same route learnt from IGRP and OSPF, IGRP route will be considered as it has alower AD(100) then OSPF (110).
3)Meteric:- If routes have same prefix length and same AD then a route with a better meteric is considered. In OSPF, cost~bandwidth is a meteric where as hop count is meteric for RIP.
4) Load sharing:- In case all the above three conditions match then data will be load balanced between the routes.