Here is a basic example of how to configure OSPF (Open Shortest Path First) on MikroTik routers. Please note that the exact commands may vary depending on the specific version of RouterOS you are using.

Here’s a step-by-step guide to configuring OSPF on MikroTik routers:

  1. Connect to your MikroTik router using SSH, Telnet, or the Winbox graphical interface.
  2. Enter the configuration mode by typing /ip route ospf or navigating to IP > Route > OSPF in Winbox.
  3. Configure the OSPF router ID. The router ID is a unique identifier for the OSPF process on each router. To set the router ID, use the following command:
   /routing ospf instance set [find] router-id=[YOUR_ROUTER_ID]

Replace [YOUR_ROUTER_ID] with the desired router ID, which can be an IP address.

  1. Configure OSPF areas. OSPF uses areas to logically group routers. Use the following command to add an OSPF area:
   /routing ospf area add name=[AREA_NAME]

Replace [AREA_NAME] with a name for your OSPF area.

  1. Add interfaces to the OSPF process. OSPF will only run on interfaces that are explicitly enabled for OSPF. Use the following command to add an interface to OSPF:
   /routing ospf interface add interface=[INTERFACE_NAME] network-type=broadcast area=[AREA_NAME]

Replace [INTERFACE_NAME] with the name of the interface you want to enable OSPF on and [AREA_NAME] with the name of the OSPF area you configured in the previous step.

  1. Optionally, adjust OSPF network costs. OSPF uses costs to determine the preferred paths. By default, MikroTik assigns costs based on interface bandwidth. If you want to adjust the cost, you can use the following command:
   /routing ospf interface set [find interface=[INTERFACE_NAME]] cost=[COST_VALUE]

Replace [INTERFACE_NAME] with the name of the interface you want to adjust the cost for, and [COST_VALUE] with the desired cost value.

  1. Configure OSPF authentication (if needed). If you want to enable OSPF authentication, you can use the following command:
   /routing ospf interface set [find interface=[INTERFACE_NAME]] authentication=yes authentication-key=[AUTHENTICATION_KEY]

Replace [INTERFACE_NAME] with the name of the interface you want to enable authentication for, and [AUTHENTICATION_KEY] with the desired authentication key.

  1. Save the configuration changes by typing /system backup save or using the Save button in the Winbox interface.

That’s it! You have now configured OSPF on your MikroTik routers. Repeat these steps on all the routers you want to participate in the OSPF process. Remember to adjust the OSPF area, interface, cost, and authentication settings based on your network requirements.