OSPF configuration on Mikrotik with EoIP

I have two routers connected over the internet by an EoIP tunnel. It’s a fairly simple network design, but I wanted to learn how to configure Mikrotik’s OSPF implementation between the two sites.

Router 1 Router 2
Network: 10.0.0.0/16
EoIP interface IP: 192.168.0.1/24
Network: 10.1.0.0/16
EoIP interface IP: 192.168.0.2/24

I previously didn’t have IP’s on the EoIP interfaces, but I thought it would make it easier if there were interface addresses for the OSPF config.

One gotcha I didn’t realise straight up is that you have to include that “edge” address space on each router’s OSPF network configuration, otherwise they don’t bother trying to share routes out that interface.

Basically what I did was:

  1. configure an IP address on the “edge” interfaces
  2. specify which address space each router “owns”
  3. create an instance (or modify the default) so that each router has a unique “router-id”
  4. assign that instance to the “backbone” area (which is the default/required one)
  5. assign the EoIP tunnel to the OSPF configuration

After about a minute the devices could see each other in the neighbours listing:

[yaleman@router2] /routing ospf neighbor> print
0 instance=default router-id=192.168.0.1 address=192.168.0.1 interface=eoip-tunnel-1 priority=1 dr-address=192.168.0.2
backup-dr-address=192.168.0.1 state="Full" state-changes=5 ls-retransmits=0 ls-requests=0 db-summaries=0 adjacency=23h21m39s

Also the routes were added to the list (trimmed for privacy/brevity). The ones to note are the lines starting with “ADo” meaning they’ve been added by OSPF.

[yaleman@router2] /ip route> print
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
#      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
0 ADS  0.0.0.0/0                          [pppoe-server]            0
1 ADo  10.0.0.0/24                        192.168.0.1             110
2 ADo  10.0.1.0/24                        192.168.0.1             110
3 ADC  10.1.0.0/24        10.1.0.1        bridge-local              0
4 ADC  10.1.1.0/24        10.1.1.1        ether1-gateway            0
7 ADC  192.168.0.0/24     192.168.0.2     eoip-tunnel-1             0

I do have some route leakage - they’re both ADSL-connected sites and the edge interfaces are being shared, but that’s my next learning job - route filters!

Example configurations

Router 1

/ip address
add address=192.168.0.1/24 disabled=no interface=eoip-tunnel-1 network=192.168.0.0

/routing ospf network 
add area=backbone disabled=no network=10.0.0.0/16 
add area=backbone disabled=no network=192.168.0.0/24

/routing ospf instance
set [ find default=yes ] disabled=no distribute-default=never !domain-id !domain-tag in-filter=ospf-in metric-bgp=auto metric-connected=20 \
    metric-default=1 metric-other-ospf=auto metric-rip=20 metric-static=20 !mpls-te-area !mpls-te-router-id name=default out-filter=ospf-out \
    redistribute-bgp=no redistribute-connected=as-type-1 redistribute-other-ospf=no redistribute-rip=no redistribute-static=as-type-1 router-id=\
    192.168.0.1 !routing-table !use-dn

/routing ospf area
set [ find default=yes ] area-id=0.0.0.0 disabled=no instance=default name=backbone type=default

/routing ospf interface
add authentication=none authentication-key="" authentication-key-id=1 cost=10 dead-interval=40s disabled=no hello-interval=10s instance-id=1 \
    interface=eoip-tunnel-1 network-type=broadcast passive=no priority=1 retransmit-interval=5s transmit-delay=1s use-bfd=no

Router 2

/ip address
add address=192.168.0.2/24 disabled=no interface=eoip-tunnel-1 network=192.168.0.0

/routing ospf network 
add area=backbone disabled=no network=10.1.0.0/16 
add area=backbone disabled=no network=192.168.0.0/24

/routing ospf instance
set [ find default=yes ] disabled=no distribute-default=never !domain-id !domain-tag in-filter=ospf-in metric-bgp=auto metric-connected=20 \
    metric-default=1 metric-other-ospf=auto metric-rip=20 metric-static=20 !mpls-te-area !mpls-te-router-id name=default out-filter=ospf-out \
    redistribute-bgp=no redistribute-connected=as-type-1 redistribute-other-ospf=no redistribute-rip=no redistribute-static=as-type-1 router-id=\
    192.168.0.2 !routing-table !use-dn

/routing ospf area
set [ find default=yes ] area-id=0.0.0.0 disabled=no instance=default name=backbone type=default

/routing ospf interface
add authentication=none authentication-key="" authentication-key-id=1 cost=10 dead-interval=40s disabled=no hello-interval=10s instance-id=1 \
    interface=eoip-tunnel-1 network-type=broadcast passive=no priority=1 retransmit-interval=5s transmit-delay=1s use-bfd=no


#HOWTO #Mikrotik #networking #OSPF