OSPF Cost Manipulation
The equation used for cost manipulation in OSPF is :-
OSPF Cost=Reference Bandwidth/Interface Bandwidth
It simply means that we can manipulate any one of the three parameters to
adjust our OSPF cost.
First of all we can apply the OSPF cost straight by the “ip ospf cost [1-65535]”
to the particular interface.Example:-
R1(conf-if)#ip ospf cost 20
Second way to accomplish this by changing the Reference Bandwidth and this is done
under OSPF process:-
R1(conf)#router ospf 1
R1(config-router)#auto-cost reference bandwidth 20000
By default,OSPF calculates the cost of an interface by dividing the bandwidth
of the interface into 100 million(10 to the power 8).
So now our formula look like this:-
OSPF Cost=100000000/interface BW in BPS
NOTE:-Whenever you change Reference Bandwidth make sure it should be same across
all routers in your OSPF domain,also the router will prompt for this:-
R1(config-router)#auto-cost reference-bandwidth 20000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
Also by default router will take auto-cost reference bandwidth in MBPS.
Rack1R1(config-router)#auto-cost reference-bandwidth ?
<1-4294967> The reference bandwidth in terms of Mbits per second
So thus using the default value and your network has interfaces with the bandwidth
greater than 100 million is not recommended,the reason is simple because OSPF
cannot differentiate between 100 mbps interface and an interface greater than
100 mbps,as in the above example “ip ospf cost”command enables you to change the
OSPF cost for an interface,but the better way to do this is to change the default
reference value.But always change the default behaviour of any protocol with
caution,so here in our scenario we need to change the default Reference cost in
every OSPF router in our routing domain.
The third way is also simple as here we need to manipulate the interface bandwidth,
to get our desired OSPF cost,it is simply done by the command:-
R1(conf)#interface Serial 0/0
R1(conf-if)#bandwidth [the numerical value]
Some Common OSPF Costs:-
10 Gig Ethernet=1
- Practical Tips for Video Interview: A step by step Guide - September 23, 2021
- HSRP vs VRRP vs GLBP – A Quick Guide - August 27, 2021
- How to configure VRRP on Cisco Devices – With Video and Quiz - August 25, 2021