The OSPF cost is a metric used by the OSPF routing protocol to determine the best path to a destination network. The cost is based on the bandwidth of the link and is calculated using the following formula:
Cost = Reference Bandwidth / Link Bandwidth
The reference bandwidth is a value that is set by the network administrator and is used to normalize the cost calculation across different bandwidths. By default, the reference bandwidth is set to 100 Mbps, but it can be changed to any value.
For example, if the reference bandwidth is set to 100 Mbps and the link bandwidth is 10 Mbps, the cost would be:
Cost = 100 / 10 = 10
In OSPF, the lower the cost, the more preferred the route. Therefore, a link with a cost of 10 would be preferred over a link with a cost of 50.