07-16-2009 04:09 AM - edited 03-04-2019 05:27 AM
Hi Team,
I have a query if i have 2 routes to the same destination one is learned via ospf and another one is via static route with AD-110.Which route will be used for forwarding the data packet and why?
07-16-2009 04:26 AM
Hi,
IMHO, static route will be used for forwarding, as it will get metric=0, even while the same AD.
BR,
Milan
07-16-2009 04:42 AM
Actually metric shouldn't matter, as it serves as comparison between routes within routing protocol. Routing table bases it's primary decision on a routing table.
Note, you cannot change metric of a static route.
Static will be preferred, i think because of internal mechanisms:
SW1(config)#ip route 7.7.7.7 255.255.255.255 10.0.0.2 111
SW1(config)#do sh ip route
7.0.0.0/32 is subnetted, 1 subnets
O 7.7.7.7 [110/2] via 10.0.0.2, 00:00:05, FastEthernet0/16
SW1(config)#ip route 7.7.7.7 255.255.255.255 10.0.0.2 110
SW1(config)#do sh ip route
7.0.0.0/32 is subnetted, 1 subnets
S 7.7.7.7 [110/0] via 10.0.0.2
07-16-2009 05:01 AM
Yes, I agree you cannot change metric of a static route - it's always 0.
I also agree metric should be used to compare only routes within one routing protocol table.
I know setting OSPF and static the same AD is incorrect and is not included in Cisco Routing Path selection algorithm
http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml
But what makes the router to chose the static route in this case?
BR,
Milan
07-16-2009 06:03 AM
static route has administrative distance 1. OSPF has administrative distance 0.
So cisco prefer static route because it have smaller administrative distance.
Metrics are compared after administrative distance comparison.
07-16-2009 12:23 PM
Hi Guys,
The router select the path to a particular destination based on the following characterstics:
1- The longest lenth of the Network is always prefered first.
2- The lowest Administrative distance is Secondly prefered.
3- If there is a tie, then the Lowest metric is prefered.
4- If there is a tie, then the router performs equal cost load-sharing.
HTH
Mohamed
07-16-2009 12:54 PM
Hi Mohamed,
I was thinking so, but Pavlo corrected me.
Let's say you assign the same Administrative distance to OSPF and EIGRP. Would it make sense to compare metrics?
Probably not.
There is another rule probably in IOS.
I guess the rule might be:
If two routing protocols are having the same AD assigned by the configurator mistake, the protocol with lower default AD wins.
(Thus static wins over OSPF in a case both having the same AD assigned, as I've seen in my lab.)
But I have not found any Cisco document confirming this idea :-(
BR,
Milan
07-20-2009 12:17 AM
Pavel, that is not what we are talking about, and you are wrong about distances. OSPF does not have AD of 0.
Mohamed, that is just basic rules what you are describing.
Here is the actual process of installing route to the routing table:
1. Routing protocol tries to install a new route into RIB.
2. RIB checks if that route is already present in the routing table. (route here being a combination of network and prefix, therefore 1.1.1.0/32 is a different route than 1.1.1.0/31 and are considered separately)
3. If it is not, it installs the route.
4. If it is already present, it asks the previous owner, to decide if the new route should be installed or not.
5. The old owner decides, if it will allow installation of new route or not, based on AD and or other internal mechanisms.
So you see, routing table itself is a passive mechanism and does not have a direct say in this. In our case, there is a static route, that tries to install itself in the routing table. RIB passes this route to the OSPF process and asks for the result.
OSPF does it's comparisons and for some reason prefers static over it's own route - this may be IOS OSPF implementation specific thing.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide