Feature Request: Cisco-style OSPF interface cost calculation

Is it possible to add support for OSPF to automatically compute Interface costs based on Interface bandwidth like Cisco does?
http://www.cisco.com/en/US/tech/tk365/technologies_white_paper09186a0080094e9e.shtml#t6
http://www.cisco.com/en/US/tech/tk365/technologies_q_and_a_item09186a0080094704.shtml#qtwo

As far as I know it is not possible to get bandwidth from an interface, so most likely RouterOS will not have such feature.

Why?

All Cisco does is look at the interface’s maximum speed and create an auto OSPF cost based on that.

/interface ethernet
:put [get [find name="ether1"] speed

This wouldn’t work well on wireless interfaces where the TX/RX rate constantly changes, but this would work well on wired interfaces.

I’d certainly like OSPF to automatically prefer my GigE interfaces over 100mbps interfaces, as theoretically they have more available bandwidth. If that isn’t the case and I need to manually adjust my interface cost, then I can.

/routing ospf interface
set [find interface="ether1"] cost=40

If you want that feature only on ethernets based on link speed then you can use your mentioned script.
It is difficult to implement this feature because OSPF can be set on different kind of interfaces (tunnels, wireless, bridges, etc) where it s not possible to detect link speed.

It would be useful to have some fairly sane auto defaults for OSPF path costs rather than ‘10’ on all interfaces. Cisco does this for OSPF and spanning tree. Possibly other protocols as well…I’m not sure. Its extremely useful.

Yes, I could run my script periodically to set these values, and adjust them when speed changes, but I’d be nice to have the OSPF daemon do this for me as it does other path re-calculations based on interface state changes. I may be a bit less disappointed by your response if there were some functionality available in MikroTik which mimics Cisco’s Embedded Event Manager. Any chance we’ll see something like this?

I don’t know for OSPF but i can confirm that for Spanning Tree or Meshing, switch manufacturers are using interface speed for path priority. Not only Cisco.

While dynamic cost calculation would be very much appreciated, I just have one question :slight_smile:
How often do ethernet interface speeds change in your setups so that you need scripts to dynamically adjust costs?
There would have to be something really wrong in your network to have an ethernet port randomly jump around between 10 100 and 1000 megabits :slight_smile:

Setting the costs correctly should be done during initial setup, normally interface speeds don’t change from what i experience…
When planning a network topology that includes anything dynamic you need to think about costs/metrics anyways and set them as you see fit.