It’s nothing new that OSPF uses a system of calculating the cost of a route to determine the open shortest path first (OSPF). Sometimes users want to manipulate the path that traffic will take as well. This could be for many reasons such as circuit reliability or even the hardware capabilities of a device. The OSPF max-metric concept is one that makes it so that when the path cost calculations are being made, the device you enter the max-metric command on will have the max value, as you would imagine. This allows you to keep the device as a valid path, but ensure that any other available path is instead used first.
Using the Max-Metric Command
router ospf 1 max-metric router-lsa
This is how you use the command in its simplest form. As mentioned, the device will cause any OSPF paths running through it to go to the bottom of the list in terms of priority. There are other options to this command though too.
Max-Metric Command Options
If we use the usual ? with this command, we can see that there are some other options we can use:
R1(config)#router ospf 1 R1(config-router)#max-metric router-lsa ? external-lsa Override external-lsa metric with max-metric value include-stub Set maximum metric for stub links in router-LSAs on-startup Set maximum metric temporarily after reboot summary-lsa Override summary-lsa metric with max-metric value
So as you can see there are a few things that may come in handy in certain situations. One that I specifically like is the “on-startup” option. You can set the max-metric option for a certain period of seconds on device startup. You could essentially say that on device bootup you want the device to set the max-metric for 10 minutes. This could allow the device to fully boot and converge with any other routing protocols, etc before possibly being used as the best path in the OSPF area.
Overall, there are many uses for this command and associated options. Keep them in mind for that special time they would come in handy.