cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1020
Views
10
Helpful
3
Replies

What happens if different OSPF costs are on two endpoints of a link?

paperangel220
Level 1
Level 1

In Packet Tracer, I have two routers, R1 and R2, which are connected to each other through R1's g0/0/0 interface and R2's g0/0/0 interface. Both routers are correctly configured with IP addresses and OSPF.

On R1's g0/0/0 interface, I entered: ip ospf cost 30. I left R2's g0/0/0's cost as 1.

Everything seems to still work normally (routes are still in the routing table, connectivity is successful between various devices), so I'm wondering if anything happens when the costs are different. I thought that something would go wrong, but I guess that's not the case?

When I enter

show ip ospf

interface g0/0/0 on both routers, the cost for R1's g0/0/0 interface is 30 while for R2 it's 1. Does that mean R1 and R2's calculations for costs will be different, as in through R1's perspective, a path going out g0/0/0 will have a cost of 30, whereas if a packet leaves R2's g0/0/0, the cost will be 1?

This probably isn't good practice to have the two interfaces on the same link have different costs, this was just something I noticed while playing around with the devices and now I'm curious as to why this is occuring. Thanks for the help!

1 Accepted Solution

Accepted Solutions

Joseph W. Doherty
Hall of Fame
Hall of Fame

"I thought that something would go wrong, but I guess that's not the case?"

Depends how you define"wrong".

"Does that mean R1 and R2's calculations for costs will be different, as in through R1's perspective, a path going out g0/0/0 will have a cost of 30, whereas if a packet leaves R2's g0/0/0, the cost will be 1?"

Correct for inclusion of interface egress cost but if by path cost if you mean cost to destination, cost is accumutive.

"This probably isn't good practice to have the two interfaces on the same link have different costs, . . ."

Can be an excellent practice; it's an it depends answer.  Such costing might represent asymmetrical bandwidths or non-bandwidth factors (e.g. $).

View solution in original post

3 Replies 3

Hello,

 

OSPF takes the cost to the neighbor into account (exit interface). That's it. Differing cost will not affect the link or adjacency.

If both are the default for the auto-cost reference-bandwidth then they will be the same cost (if the same link). The manual interface configuration overrides the calculation

 

Think of it like this: On a Multiaccess network when several routers plug into a switch with each router connecting at a different speed. Maybe 1 router connect at 1G, another router connects at 100Mg, a third router connects at 10G. In addition to using the auto-cost reference-bandwidth command so they are using the 10 Gig link as the reference (highest in the topology) They will have different costs but still function normally. AS mentioned its the cost to get to the neighbor as seen by the OSPF router you're on and viewing the network from.

 

To your comment:


@paperangel220 wrote:

When I enter show ip ospf interface g0/0/0 on both routers, the cost for R1's g0/0/0 interface is 30 while for R2 it's 1. Does that mean R1 and R2's calculations for costs will be different, as in through R1's perspective, a path going out g0/0/0 will have a cost of 30, whereas if a packet leaves R2's g0/0/0, the cost will be 1?




The calculations for the cost is the same (hopefully if you made the auto-reference BW the same on all devices as you should) - but you entering the cost on the link overrides that and just applies it. No calculation needed on that link. 

-David

This can lead to asymmetric routing in some topolgy.

So as you mention it not recommend.

Joseph W. Doherty
Hall of Fame
Hall of Fame

"I thought that something would go wrong, but I guess that's not the case?"

Depends how you define"wrong".

"Does that mean R1 and R2's calculations for costs will be different, as in through R1's perspective, a path going out g0/0/0 will have a cost of 30, whereas if a packet leaves R2's g0/0/0, the cost will be 1?"

Correct for inclusion of interface egress cost but if by path cost if you mean cost to destination, cost is accumutive.

"This probably isn't good practice to have the two interfaces on the same link have different costs, . . ."

Can be an excellent practice; it's an it depends answer.  Such costing might represent asymmetrical bandwidths or non-bandwidth factors (e.g. $).

Review Cisco Networking for a $25 gift card