cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8249
Views
15
Helpful
14
Replies

how is route cost calculated

tato386
Level 6
Level 6

When I do a show ip route command I see that routes have a metric like this [120/1] etc. How is the admin distance and offset weighted to calculate the cost? For example is a route with [100/5] as a metric preferred over a route showing [120/3]?

Thanks,

Diego

14 Replies 14

buchholr
Level 1
Level 1

What you are seeing in the brackets is the AD (administrative distance) and the metric. The AD is not used in calculating the cost at all. It is used to determine which route is the most believable in the case of two protocols having the same network.

For example if you had a route from RIP to 10.0.0.0/24 and a route from IGRP to the same network, you cannot directly compare the metrics as they are calculated differently. The router will choose the IGRP route over the RIP route as the AD for IGRP is 100 and the AD for RIP is 120 (lower is better).

HTH,

Rob

But part of my confusion is that the AD can be modified. I can easily have my RIP routes show an AD of 10 if I wanted. Ultimately if the router needs to make a choice between two routes I would think it used both AD and metric. So my question is how would it weigh each component? Maybe its just a simple multiplication problem? Going back to my example, which route would be chosen as the preferred route?

Router only takes AD into considerqtion when it has multiple routes in the routing table through different routing Protocols.Lets say you have two routes in routing table for a network x.x.x.x and they are reported by RIP and OSPF then router will select OSPF due to its AD.

If only one routing protocol is used then only metric is taken into consideration.

AD manipulation is used where it is required to give prefrence to a particular route which is learned throug a routing protocol with higher AD.

Syed

Somehow I don't think that's right. Isn't the metric the same as the hop count? So lets say I router has a route to 1.1.1.0 that it learned via OSPF and the AD/metric looks like this [100/12]. AD is 100 but hop count is 12 which is a lot of hops! Now it gets a RIP route to 1.1.1.0 that looks like this [120/1]. Yes the AD is higher but it is only 1 hop away. Will it still go with the OSPF?

Diego

Every routing protocol uses different metrics.

Rip uses Hop count as metric where as OSPF uses cost associated with the interface.

If every routing protocol was using the same metric then AD was not needed.

To answer your question if you see [100/12] then 12 is not the hop count in case of OSPF.

Its the cost to reach the advertised network.

Syed

Hop count is only used as the metric in RIP and RIPv2.

OSPF uses cost which is (10^8)/(b/w of slowest link)

IGRP and EIGRP use a composite of Bandwidth and Delay to calculate the metric by default, EIGRP multiplies the value by 256.

With this in mind, lets look at a very simple example:

10.0.0.0/24-->(router a)--10mbps ethernet-->(router b)

The RIP metric from router b to 10.0.0.0/24 is 1.

The OSPF metric from router b to 10.0.0.0/24 is (10^8/10000000)=10

The IGRP metric is 1100 and EIGRP is 281600.

Since each of these metrics is derived differently they cannot be directly compared, so the router uses the AD to determine which is more trustworthy.

Protocol AD

RIP 120

OSPF 110

IGRP 100

EIGRP 90

So when all other things are equal, the lower AD always wins. The adjustment of the AD is for situations where you want to change the default behavior. For example, if you are trying to migrate to EIGRP from RIP, you can set the AD of EIGRP to higher than 120 until the entire network configuration is done, and then change the AD back when you are sure the EIGRP network configurations are stable.

HTH,

Rob

P.S. Here is a Cisco document that also describes the route selection process, and a link at the bottom takes you to a document on administrative distance.

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml

Thanks, I see where my confusion comes from now. Until now I have only used RIP and I am thinking about moving to EIGRP or maybe OSPF. I have made extensive use of AD and offset statements to modify default behavior due to a highly redundant network that we have put in place. What I was attempting to do is to gauge what the introduction of EIGRP or OSPF would do and how I would manage the AD/metric changes I will have to deal with when introducing the new routing protocol. I would assume that EIGRP or OSPF would also have extensive methods to modify AD/metrics/costs similar to RIP, no?

Also, do you know if there is a way to see the "hidden" routes that have been received but are not shown in "sho ip route" because they were not chosen as the preferred route? This might come in handy when troubleshooting my migration.

Thanks,

Diego

show ip rip database

show ip ospf [area-id] database

show ip eigrp [as-number]

These three commands will show their respective databases of information. These databases will have all of the information received by that protocol regardless of whether it is installed in the routing table.

Rob

I only have RIP running but the command doesn't seem to be working as you state. I know that I have at least two routes to all my subnets. I get rip from a router connected via Fa0 and another connected via GRE tunnel. If I were to use the defaults both routes would have [120/1] as their AD/metric and traffic would be sent thru both links. Since my GRE is a backup route only to be used when Fa0 path is not available I have purposely upped the metric to 10 on the GRE routes to suppress them. When the Fa0 is shutdown the GRE routes are installed. However when I use ip rip database I don't see the routes from the GRE tunnel only that Fa0 routes. I was looking for a way to confirm that we were receiving the routes from GRE without having to shutdown Fa0 but the ip rip database doesn't seem to do the trick.

Thanks,

Diego

Diego

Diego,

What you see is normal. RIP isn't as advanced as EIGRP and OSPF.

As the previous poster stated, those commands will show you all available routes for such protocol with the exception of RIP.

With EIGRP, you have the concept of feasible successor of a route and OSPF is a link state protocol so all OSPF links will be listed.

RIP is a distance vector protocol and only active routes are kept in the database. If you were to lose the Fa0 link, RIP will recalculate the best path out of the network by flushing the entire database and requesting a new one from its neighbors. It doesn't have a 'successor' listed on its database.

HTH,

__

Edison.

Not sure why the routes aren't in the RIP database, can you post running-configs?

Rob

In a previous post ediortiz claims that RIP is not as sophisticated as the other protocols and the RIP database commmands will not work. That jives with what I am seeing.

Diego

Diego,

want some confirmation ? :)

S2#sh ip rip data

172.16.0.0/16 auto-summary

172.16.1.1/32

[1] via 192.168.2.1, 00:00:22, FastEthernet0/14

[1] via 192.168.1.1, 00:00:21, FastEthernet0/13

192.168.1.0/24 auto-summary

192.168.1.0/30 directly connected, FastEthernet0/13

192.168.2.0/24 auto-summary

192.168.2.0/24

[10] via 192.168.2.1, 00:00:03, FastEthernet0/14

192.168.2.0/30 directly connected, FastEthernet0/14

S2(config)#router rip

S2(config-router)#offset-list 0 in 3 fastEthernet 0/13

S2#sh ip rip data

172.16.0.0/16 auto-summary

172.16.1.1/32

[1] via 192.168.2.1, 00:00:05, FastEthernet0/14

192.168.1.0/24 auto-summary

192.168.1.0/30 directly connected, FastEthernet0/13

192.168.2.0/24 auto-summary

192.168.2.0/30 directly connected, FastEthernet0/14

!

S2(config)#int f0/14

S2(config-if)#shut

S2(config-if)#

00:13:07: %LINK-5-CHANGED: Interface FastEthernet0/14, changed state to administratively down

00:13:08: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/14, changed state to down

S2(config-if)#do show ip rip data

172.16.0.0/16 auto-summary

172.16.1.1/32

[4] via 192.168.1.1, 00:00:21, FastEthernet0/13

192.168.1.0/24 auto-summary

192.168.1.0/30 directly connected, FastEthernet0/13

192.168.2.0/24 is possibly down

192.168.2.0/30 is possibly down

HTH,

__

Edison.

Please rate helpful posts

I believe you dude. I see the same thing. I was responding to a previous poster who was trying to help me with using the ip rip database command.

I realize now that I gotta learn OSPF!!

Thanks,

Diego

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card