Paths are chosen using the cost to the destination. The cost is calculated using the formula Cost = Reference Bandwidth / Bandwidth. By default the reference bandwidth it 100Mbits. That means that the default costs for common bandwidths are:

BANDWIDTHCOST
1 Gbit0
100 Mbit1
10 Mbit10
1.544 Mbit64
128 Kbps781
64 Kbps1562

The obvious issue with this is that in modern networks Gigabit speeds are not uncommon and interface speeds exceeding 1Gbps will not be given any more preference. For example the cost calculation for 1Gbps interface is the same as for a 40Gbps interface. Clearly one is much faster than the other but OSPF will not prioritize the faster connection as the cost for both is the same. In such a network you would need to amend you reference bandwidth. Care must be taken to amend all routers in the network similarly otherwise cost calculations will mean that sub-optimal routes are used.

n.b.: OSPF does not deal with decimals so the cost values are rounded off and not exact compared to the result of the calculation.

Path preference is chosen by using the path with lowest total cost to the destination network. Where there are two paths with a tied cost the traffic is load balanced.
If Load Balancing is not a scenario that fits your network and you would be better off having the second link as a backup route to the primary then the best thing to do is to modify the OSPF cost on the interface, making it higher than the preferred path will mean that it will not become active in the routing table unless the primary route is not available. Changing the cost is more granular than using the bandwidth command. Manipulating the bandwidth command will alter all routing protocols that are using the link.

Useful Commands

router# show ip route ospf
router# show ip ospf interface

If you need a new website or your website needs updating go to https://10kinds.tech.

10 Kinds Technology
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram