ECMP with OSPF trouble

Good morning.

I have a question with ECMP: i would like to know if it’s possible or what alternatives there are to do load balancing in this tophology with OSPF or another IGP:

 R1 --------> Sw1 --------> |
               |            | R2
               |__________> | 
               
R1  = CCR2004 (router with OSPF)
Sw1 = CRS317 (switch)
R2  = RB4011 (router with OSPF)

R1 → Sw1 is a 10Gbps FO link
Sw1 ->R1 they are 2 wireless links

R1 SIDE:
/routing ospf instance print
Flags: X - disabled, I - inactive 
 0   name="default-v2" version=2 vrf=main router-id=172.24.1.1 originate-default=never 
 
/routing ospf interface-template
add area=backbone-v2 comment="R1->R2 1st link" cost=10 interfaces=bridge1 networks=172.23.0.12/30 priority=1 type=ptp
add area=backbone-v2 comment="R1->R2 2nd link" cost=10 interfaces=bridge1 networks=172.23.0.36/30 type=ptp

/routing ospf neighbor print
1  D instance=default-v2 area=backbone-v2 address=172.23.0.14 router-id=192.168.251.21 state="Full" state-changes=10 adjacency=1d11h9m17s timeout=32s 
8  D instance=default-v2 area=backbone-v2 address=172.23.0.38 router-id=192.168.251.21 state="Full" state-changes=6 adjacency=5m29s timeout=31s

/routing route print where dst-address="192.168.251.0/27"
Flags: A - ACTIVE; o, y - COPY; +, B - BLACKHOLE
Columns: DST-ADDRESS, GATEWAY, AFI, DISTANCE, SCOPE, TARGET-SCOPE, IMMEDIATE-GW
    DST-ADDRESS       GATEWAY              AFI  DISTANCE  SCOPE  TARGET-SCOPE  IMMEDIATE-GW       
Ao+ 192.168.251.0/27  172.23.0.14%bridge1  ip4       110     20            10  172.23.0.14%bridge1
Ao+ 192.168.251.0/27  172.23.0.38%bridge1  ip4       110     20            10  172.23.0.38%bridge1

/ip route print det where dst-address=192.168.251.0/27
Flags: D - dynamic; X - disabled, I - inactive, A - active; c - connect, s - static, r - rip, b - bgp, o - ospf, d - dhcp, v - vpn, m - modem, y - copy; H - hw-offloaded; + - ecmp 
   DAo + dst-address=192.168.251.0/27 routing-table=main gateway=172.23.0.14%bridge1 immediate-gw=172.23.0.14%bridge1 distance=110 scope=20 target-scope=10 suppress-hw-offload=no 

   DAo + dst-address=192.168.251.0/27 routing-table=main gateway=172.23.0.38%bridge1 immediate-gw=172.23.0.38%bridge1 distance=110 scope=20 target-scope=10 suppress-hw-offload=no

But traffic is using only the first route via 172.23.0.14 and ignoring the second one.

Any help would be appeciated!

OSPF will not load balance the way that you are thinking and with only two connections it will duplex the link typically, you can use ECMP but that is a bit harder to setup. If you don’t need OSPF you can use mangle rules and routing marks and per connection classifiers to accomplish the same thing.

https://wiki.mikrotik.com/wiki/Manual:IP/Route#Multipath_.28ECMP.29_routes

Thank you for your tip.

I did something similar: i created a route table with a default route pointing to the empty link with check_gateway=arp. Then I created some route rules to force some destinations to the empty link.

I’m not so happy but it’s working

/routing table add fib name=via-af5-2
/ip route add check-gateway=arp disabled=no distance=1 dst-address=0.0.0.0/0 gateway=172.23.0.38 pref-src=0.0.0.0 routing-table=via-af5-2 scope=30 suppress-hw-offload=no target-scope=10
/routing rule add action=lookup disabled=no dst-address=192.168.249.0/24 table=via-af5-2

This post is a little stale but hopefully you noticed the later thread: http://forum.mikrotik.com/t/ospf-load-balancing-broken-in-v7-1-1/155109/1

What you’re describing is technically doable and according to your output, the two OSPF routes are installed with a + for ECMP. It seems like you probably hit the bug with ECMP on CCR2004 rather than anything actually being wrong.