02-23-2023 05:12 PM - last edited on 03-02-2023 01:13 AM by Translator
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!
Solved! Go to Solution.
02-23-2023 11:49 PM
"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. $).
02-23-2023 05:38 PM - edited 02-23-2023 06:24 PM
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
02-23-2023 10:19 PM
This can lead to asymmetric routing in some topolgy.
So as you mention it not recommend.
02-23-2023 11:49 PM
"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. $).
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