The cost (also called metric) of an interface in OSPF is an indication of the overhead required to send packets across a certain interface.Open Shortest Path First (OSPF) uses cost as the metric calculated, based on the bandwidth of the link. The cost of a link is calculated by dividing the reference bandwidth (100 Mbps by default) by the interface bandwidth. The total cost to a destination is the cost of the individual links in the path to the destination.
- The OSPF cost value varies from 0 to 65535.
- Cost can be set up for respective interfaces, as desired.
- The smaller cost means smaller distance.
- Some routers automatically add costs, depending on the line speed, but, it may not be able to support the speedup of the network. Therefore, it is safe to explicitly set up the important interfaces including backbone.
The cost can also be manually assigned under the interface configuration mode. The cost is a 16-bit number, so it can be any value from 1 to 65,535.
Router(config-router)#ip ospf cost 27