Configuring Interface Cost

Each interface has an outbound cost associated with it. The lower the cost, the more likely the interface will be used to forward data traffic. Should several equal-cost routes to a destination exist, traffic is distributed equally among them.

The formula for calculating the OSPF interface cost metric is the reference bandwidth divided by the interface bandwidth. By default the reference bandwidth is set to 100 Mbps. For 10 Mbps links, the resulting cost is 10. For 100, 1000, or 10000 Mbps links, the resulting cost is 1. The reference bandwidth can be modified using the auto-cost reference-bandwidth command in OSPF configuration mode. The ability to re-center the reference bandwidth to a higher value, allows for OSPF interface costs to default to a value greater than 1 for 100, 1000, or 10000 Mbps links and greater than 10 for 10 Mbps links.

It is recommended that the auto cost reference bandwidth be the same value for all OSPF routers in the domain.

Use the ipv6 ospf cost command in interface configuration command mode to statically specify the outbound cost of this interface. A statically configured OSPF interface cost overrides all other interface cost methods.

For logical interfaces containing multiple physical interfaces, such as a LAG, the aggregate interface speed is not readily available. A tracked object configured with the ports belonging to the logical interface can return the physical interface speed of each physical port specified in the tracked object. OSPF will sum the returned interface speeds and use that aggregate value when calculating OSPF interface cost. Because the tracked object will report when a physical interface is up or down, OSPF will dynamically adjust the aggregate speed when an interface becomes active or goes down and adjust the OSPF interface cost accordingly. This method should be used in LAG and ECMP logical interface contexts.

Note

Note

The speed used in the cost calculation is sum of all ports capabilities in the tracked object. Setting the speed manually will not change the tracked interface speed. A 1GB capable port has a 1 GB speed regardless of the manual speed setting. The same holds true for ports that auto-negotiate to a lower speed. The expectation is that both sides of the link are using the same ports and SFP connectors and should result in the same speed.

Use the ipv6 ospf cost track command in interface configuration mode to calculate the OSPF interface cost based upon summing physical interface speeds that belong to a logical interface.

When adding an additional physical port to a logical interface that uses the interface summation method to determine OSPF interface cost, you must also add the physical port to the associated tracked object.

See Tracked Object Manager Configuration for tracked object configuration details.