IPv6: OSPF Cost

From OnnoWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Cost

OSPF uses a reference bandwidth of 100 Mbps (10^8) for cost calculation. The formula to calculate the cost is reference bandwidth divided by interface bandwidth ; Interface Cost= 10^8/(interface bandwidth). Calculated values are rounded up to the nearest single decimal value. This means that OSPF will calculate interfaces with speeds higher than 10 Mbps as a cost of 1 (Table 1). T he result of this is that OSPF routers in the network cannot make an accurate path calculation when comparing fast Ethernet interface versus a gigabit Ethernet interface as both interfaces has a cost of 1. [2] Interface Type Cost 100 Gbps 1 40 Gbps 1 10 Gbps 1 10 Gbps 1 1 Gbps 1 100 Mbps 1 10 Mbps 10 1.544 Mbps 64 768 Kbps 133 384 Kbps 266 128 Kbps 781

Table 1 - Default OSPF cost calculations.

There are two methods for changing the calculated costs - auto-cost and interface cost.

The auto-cost reference-bandwidth command allows you to change the reference bandwidth that OSPF uses to calculate its metrics:

router ospf 1

 ...  
 auto-cost reference-bandwidth 1000000

REMEMBER You must ensure the reference bandwidth is consistent across all routers.

ip ospf cost can also be used to change the OSPF cost. However, this works on a per-interface basis and will override the calculated cost.

int gi0/1

 ...
 ip ospf cost 1234

To verify the interface cost, the following command is used:

show ip ospf interface | inc Cost

 Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
 Topology-MTID    Cost    Disabled    Shutdown      Topology Name
 Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
 Topology-MTID    Cost    Disabled    Shutdown      Topology Name