How to configure OSPF routing on MikroTik

OSPF (Open Shortest Path First) is an IGRP (Interior Gateway Routing Protocol) routing protocol. This time we will try to configure OSPF routing on MikroTik, but before we discuss what OSPF is.

Read also: How to configure RIP routing on MikroTik

What is OSPF

OSPF (Open Shortest Path First) is an IGRP (Interior Gateway Routing Protocol) routing protocol that can only work in the internal network of an organization or company. Internal network means a network in which you still have the right to use, manage and modify it. Or, in other words, you still have administrative rights to the network. If you no longer have usage and management rights, then the network may be classified as an external network.

In addition, OSPF is also an open standard routing protocol. The idea is that this routing protocol is not created by any vendor. Thus, anyone can use it, any device can be compatible with it and wherever this routing protocol can be implemented. OSPF is a routing protocol that uses the concept of routing hierarchy, which means that OSPF divides the network into several levels.

Configure MikroTik OSPF

Once you understand the explanation about OSPF. Now we will try to configure OSPF MicroTik. In this case study, we have 3 routers located in one area, namely the backbone area, each router having a LAN. Here we will try to ensure that each LAN on the three routers can communicate with each other without using static routing.

1. Before configuring OSPF on MikroTik, if you are using Gns3, we will first create a topology as shown below.

Routing topology MikroTik OSPF

MiktoTik1:

  • Ether1 = 12.12.12.1
  • Ether2 = 192.168.10.1
  • Pod = 1.1.1.1/32

MicroTik2:

  • Ether1 = 12.12.12.2
  • Ether2 = 14.14.14.2
  • Ether3 = 192.168.20.1
  • Pod = 2.2.2.2/32

MiktoTik3:

  • Ether1 = 14.14.14.1
  • Ether2 = 192.168.30.1
  • Bridge = 3.3.3.3/32

PC client:

  • Client PC MikroTik1 – Ether1 = 192.168.10.2
  • Client PC MikroTik2 – Ether1 = 192.168.20.2
  • Client PC MikroTik3 – Ether1 = 192.168.30.2

2. As usual, configure the IP address on each MikroTik router. But this time add a bridge interface with the loopback name to be the router ID.

Router1:

[[email protected]] > system identity set name=Router1
[[email protected]] >interface bridge add name=loopback
[[email protected]] > ip address add address=12.12.12.1/24 interface=ether1
[[email protected]] > ip address add address=192.168.10.1/24 interface=ether2
[[email protected]] > ip address add address=1.1.1.1/32 interface=loopback
How to configure OSPF routing on MikroTik 1

Router2:

[[email protected]] > system identity set name=Router2
[[email protected]] >interface bridge add name=loopback
[[email protected]] > ip address add address=12.12.12.2/24 interface=ether1
[[email protected]] > ip address add address=14.14.14.2/24 interface=ether2
[[email protected]] > ip address add address=192.168.20.1/24 interface=ether3
[[email protected]] > ip address add address=2.2.2.2/32 interface=loopback
Configuring the MikroTik Router2 IP address

Router3:

[[email protected]] > system identity set name=Router3
[[email protected]] >interface bridge add name=loopback
[[email protected]] > ip address add address=14.14.14.1/24 interface=ether1
[[email protected]] > ip address add address=192.168.30.1/24 interface=ether2
[[email protected]] > ip address add address=3.3.3.3/32 interface=loopback
Configuring the MikroTik Router3 IP address

If you use Winbox to add a bridge interface, you can go to the menu Bridge then click the icon +.

OSPF Bridge Loopback

To configure the IP address you can do it in the menu IP> Address then click the icon +.

Configuring the IP address of the MikroTik Winbox router

3. Then make the IP configuration on each Client PC as in the topology above. To do this in Gns3, use the following command.

PC-1> ip 192.168.10.2 255.255.255.0 192.168.10.1
Checking for duplicate address…
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1
PC-2> ip 192.168.20.2 255.255.255.0 192.168.20.1
Checking for duplicate address…
PC2 : 192.168.20.2 255.255.255.0 gateway 192.168.20.1
PC-3> ip 192.168.30.2 255.255.255.0 192.168.30.1
Checking for duplicate address…
PC2 : 192.168.30.2 255.255.255.0 gateway 192.168.30.1
Gns3 client IP configuration

4. Then we activate OSPF on each router and record the router ID and the network that is connected directly from each router.

Router1:

[[email protected]] > routing ospf interface add interface=ether1
[[email protected]] > routing ospf instance set 0 redistribute-connected=as-type-1 router-id=1.1.1.1
[[email protected]] > routing ospf network add network=12.12.12.0/24 area=backbone
[[email protected]] > routing ospf network add network=192.168.10.0/24 area=backbone
[[email protected]] > routing ospf network add network=1.1.1.1/32 area=backbone
MikroTik Router OSPF Configuration1

If you use Winbox, you can configure the OSPF interface in the Routing menu> OSPF and then on the tab INTERFACE click the icon +.

OSPF Router Interfaces 1 Dan 3 Winbox

To configure the OSPF instance again in the same menu, then click the tab court then click the icon +.

Winbox OSPF Router1 instance

Also in the same menu, click the tab networking then click the icon + to add the OSPF network configuration.

OSPF Networks Router1 Winbox

Router2:

[[email protected]] > routing ospf interface add interface=ether1
[[email protected]] > routing ospf interface add interface=ether2
[[email protected]] > routing ospf instance set 0 redistribute-connected=as-type-1 router-id=2.2.2.2
[[email protected]] > routing ospf network add network=12.12.12.0/24 area=backbone
[[email protected]] > routing ospf network add network=14.14.14.0/24 area=backbone
[[email protected]] > routing ospf network add network=192.168.20.0/24 area=backbone
[[email protected]] > routing ospf network add network=2.2.2.2/32 area=backbone
OSPF MikroTik Router2 configuration
OSPF Router2 Winbox interfaces
Winbox OSPF Router2 instance
OSPF Networks Router2 Winbox

Router3:

[[email protected]] > routing ospf interface add interface=ether1
[[email protected]] > routing ospf instance set 0 redistribute-connected=as-type-1 router-id=3.3.3.3
[[email protected]] > routing ospf network add network=14.14.14.0/24 area=backbone
[[email protected]] > routing ospf network add network=192.168.30.0/24 area=backbone
[[email protected]] > routing ospf network add network=3.3.3.3/32 area=backbone
OSPF MikroTik Router3 configuration
OSPF Router Interfaces 1 Dan 3 Winbox
Winbox OSPF Router3 instance
OSPF Networks Router3 Winbox

5. If you tried to check the routing table using the command:

[[email protected]] > ip route print
Check the OSPF routing table
Test PING OSPF PC Client

If the status is ADC and can ping between computers, then OSPF is running.

Conclusion

Here’s how to set up OSPF routing in MikroTik. Pretty easy, isn’t it? Please note that when using the OSPF protocol, it will manage routes in a dynamic network structure that can use different paths to its subnets. Always choose the shortest path to the subnet first, because OSPF uses a link state protocol.


So many articles How to configure OSPF routing on MikroTik. Looking forward to more interesting articles and don’t forget to share this article with your friends. Thank you…

Leave a Comment

/* */