cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8218
Views
24
Helpful
16
Replies

Which interface is added by OSPF cost?

r-kitagawa
Level 1
Level 1

Hi Sir,

I ask question of OSPF cost.

I want to know when add OSPF cost of interface.

When I configure 'ip ospf cost' on router's interface,

is OSPF cost added by incoming interface or outgoing interface?

Ryusuke.

16 Replies 16

Like Tharak's illustration which helps to dispel a little a confusion caused by previous responses :-).  But I believe it may not be 100% correct. First, (and indeed always), as Tharak mentioned, it helps to define the terminology, in relation to inbound and outbound interfaces (or ingress, egress) - without that the definition like 'inbound interface' is meaningless. Things like that are abound not only in CISCO but any other technical documentation, which is the main reason for the very forums like this - if documentation thoroughly written nobody would have any questions :-). 

 

So the cost value affects not the interface but the traffic coming in/out on it. In case we are talking about data traffic that would be outbound traffic - cost assigned (or calculated by OSPF) on interface affects outbound data traffic. But more precise it actually affects inbound control traffic, thats the routes updates. When update is coming to interface the OSPF calculates the incoming route cost based on the cost value on the interface. Then routes installed into rib affect data traffic correspondingly. So an accurate definition would be that interface cost is affecting inbound (control) traffic, not outbound (data). Data packets no nothing about interface cost, they only know the route installed by OSPF into rib (to illustrate - shut down OSPF process and what data packet will do about interface cost?).  

 

So far so good. Now, talking about example - the above definition would mean that cost used for calculation (with either default values or modified) for router r11 would be sum of r11/g0.0 + r12/g0.1 + r13/g0.0  ( not R13/loopback + Cost of R12/Gig 0/1 + Cost of R11/Gig 0/0 as explained in the example), that is loopback cost should not matter as loopback is a generating interface, thats outbound, while r13/g0.0 is inbound in relation to loopback. Result is 3 with default cost and 10 with modified cost. 

 

Similar in reverse - r13 receives routes generated by r11 loopback, so full cost is r11/g0.0 + r12/g0.0 + r13/g0.0, all inbound physical interfaces. When sending update for loopback its loopback that is initial source of the route so its outbound and its cost is of no consideration. When router receives route its gi interface that receives, not loopback, so loopback is again of no consequence. Result cost is 3 in either direction. 

 

Now, I sure would check it in the lab as well, as after all the Loopback is a special interface and we are dealing here not with laws of nature but with whims of CISCO developers. So while the above explanation looks logical and in line with general definitions, its not impossible that in case of Loopback all bets are off and somehow the inbounds or outbounds no longer matter. :-)

 

 

This is an update to my original. I followed my advice and checked it in the lab. Not too surprisingly the actual performance indeed differed from logic presented. Again, we are not talking about laws of nature. So (at least on CISCO, dont know about other vendors) the implementation considers Loopback interfaces as 'receiving' updates from the imaginary (=virtual) network the IP of loopback belongs to. So total cost of the route would be all the inbound (for control traffic) interfaces costs starting with Loopback cost as first 'inbound' interface. Changing cost of loopback at router 13 will correspondingly change the total cost for route installed into R11. 

Rules for external routes ignore this (also confirming the notion of cost assigned on inbound interface) - thats if interface receives the route update which it identifies as external it will ignore whatever original cost it might have and simply assign it cost of 20 (by default, unless you decide to designate external routes as E1 type, but thats yet another topic).

Review Cisco Networking products for a $25 gift card