OSPF - Routes marked as inactive

I am trying to run a second OSPF instance to provide automated routing redundancy between 3 sites. The infrastructure is currently routed statically and routes appear in the OSPF LSA tables but the OSPF route table marks the routes as inactive. I’ve temporarily disabled the instance on router 3 to make it easier to debug.

Router1:

/routing ospf instance
  add in-filter=ospf-mpls-in name=mpls out-filter=ospf-mpls-out \
    redistribute-connected=as-type-1 redistribute-static=as-type-1 router-id=\
    172.19.213.3 routing-table=mpls
/routing ospf area
  add instance=mpls name=mpls
/routing ospf interface
  add authentication=md5 hello-interval=1s interface=telkom-vlan1 \
    network-type=point-to-point
  add authentication=md5 hello-interval=1s interface=gre-tunnel-261 \
    network-type=point-to-point cost=50
/routing ospf network
  add area=mpls network=172.19.101.0/29
  add area=mpls network=172.31.255.0/24

Router2:

/routing ospf instance
  add in-filter=ospf-mpls-in name=mpls out-filter=ospf-mpls-out \
    redistribute-connected=as-type-1 redistribute-static=as-type-1 router-id=\
    172.19.213.3 routing-table=mpls
/routing ospf area
  add instance=mpls name=mpls
/routing ospf interface
  add authentication=md5 hello-interval=1s interface=telkom-vlan1 \
    network-type=point-to-point
  add authentication=md5 hello-interval=1s interface=gre-tunnel-261 \
    network-type=point-to-point cost=50
/routing ospf network
  add area=mpls network=172.19.213.0/29
  add area=mpls network=172.31.255.0/24

Router1 creates a LSA for one of the routes:

routing ospf lsa print detail where id=196.31.200.15
 instance=mpls area=external type=as-external id=196.31.200.15 
   originator=172.19.101.4 sequence-number=0x80000002 age=932 checksum=0xA066 
   options="E|DN" body=
     netmask=255.255.255.255
     forwarding-address=172.31.255.6
     metric=20
     route-tag=0x0
     type1

Router1 creates an OSPF route:

routing ospf route print detail where dst-address="196.31.200.15/32"
 0 instance=mpls dst-address=196.31.200.15/32 state=imported-ext-1 gateway="" 
   interface="" cost=20 area=external

Router2 learns the LSA from Router1:

routing ospf lsa print detail where id=196.31.200.15
 instance=mpls area=external type=as-external id=196.31.200.15 
   originator=172.19.101.4 sequence-number=0x80000002 age=1081 checksum=0xA066 
   options="E|DN" body=
     netmask=255.255.255.255
     forwarding-address=172.31.255.6
     metric=20
     route-tag=0x0
     type1

Router2 does not activate the route:

routing ospf route print detail where dst-address="196.31.200.15/32"
 0 instance=mpls dst-address=196.31.200.15/32 state=inactive gateway="" 
   interface="" cost=infinity area=external

Probably because 172.31.255.6 cannot be resolved in that “mpls” routing table.

I didn’t realise that OSPF wouldn’t resolve static routes for the destinations. Disabling the static routes resulted in the OSPF propagated routes becoming active and the inactive route then being active:

Before disabling the static routes:

ip route print detail where dst-address in 172.19.105.0/29
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 
 0 A S  ;;; Direct Transact - SR - MPLS:
        dst-address=172.19.105.0/29 gateway=172.31.255.17 
        gateway-status=172.31.255.17 on mpls reachable via  telkom-vlan5 
        check-gateway=ping distance=1 scope=30 target-scope=10 
        routing-mark=mpls 

 1   S  ;;; Direct Transact - SR - MPLS:
        dst-address=172.19.105.0/29 gateway=172.31.255.22 
        gateway-status=172.31.255.22 on mpls reachable via  gre-tunnel-461 
        check-gateway=ping distance=10 scope=30 target-scope=10 
        routing-mark=mpls 

 2  Do  dst-address=172.19.105.0/29 gateway=172.31.255.17 
        gateway-status=172.31.255.17 on mpls reachable via  telkom-vlan5 
        distance=110 scope=20 target-scope=10 routing-mark=mpls 
        bgp-ext-communities="OSPF Route Type:0.0.0.0:2:0,OSPF Router 
                    ID:172.19.213.3:0,OSPF Domain ID:0x0005:0x0 0x0 0x0 0x0 0x0 
                    0x0" 
        ospf-metric=20 ospf-type=intra-area

Hrm… I have some other routes which refuse to become active where the next hop is reachable. This route originates via a static route on router2 and should be learnt and installed in Router1:
Router2:

routing ospf route print detail where dst-address="172.16.200.0/24"
 0 instance=mpls dst-address=172.16.200.0/24 state=imported-ext-1 gateway="" 
   interface="" cost=20 area=external



routing ospf lsa print detail where id=172.16.200.0
 instance=mpls area=external type=as-external id=172.16.200.0 
   originator=172.19.213.3 sequence-number=0x80000001 age=240 checksum=0x1FEA 
   options="E|DN" body=
     netmask=255.255.255.0
     forwarding-address=172.19.213.1
     metric=20
     route-tag=0x0
     type1

Router1:

routing ospf route print detail where dst-address="172.16.200.0/24"
 0 instance=mpls dst-address=172.16.200.0/24 state=inactive gateway="" interface="" cost=infinity 
   area=external



routing ospf lsa print detail where id=172.16.200.0
 instance=mpls area=external type=as-external id=172.16.200.0 originator=172.19.213.3 
   sequence-number=0x80000001 age=283 checksum=0x1FEA options="E|DN" body=
     netmask=255.255.255.0
     forwarding-address=172.19.213.1
     metric=20
     route-tag=0x0
     type1

Router1 does have an active route to the forwarding address:

ip route print detail where dst-address in 172.19.213.0/29
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 
 0 ADo  dst-address=172.19.213.0/29 gateway=172.31.255.2 
        gateway-status=172.31.255.2 on mpls reachable via  telkom-vlan1 distance=110 scope=20 
        target-scope=10 routing-mark=mpls 
        bgp-ext-communities="OSPF Route Type:0.0.0.0:2:0,OSPF Router ID:172.19.101.4:0,OSPF Domain 
                    ID:0x0005:0x0 0x0 0x0 0x0 0x0 0x0" 
        ospf-metric=20 ospf-type=intra-area 

 1 ADo  dst-address=172.19.213.3/32 gateway=172.31.255.2 
        gateway-status=172.31.255.2 on mpls reachable via  telkom-vlan1 distance=110 scope=20 
        target-scope=10 routing-mark=mpls 
        bgp-ext-communities="OSPF Route Type:0.0.0.0:2:0,OSPF Router ID:172.19.101.4:0,OSPF Domain 
                    ID:0x0005:0x0 0x0 0x0 0x0 0x0 0x0" 
        ospf-metric=20 ospf-type=intra-area

I found what I needed to do in the following thread:
http://forum.mikrotik.com/t/two-ospf-vrf-instances/42133/1

Simply set the VRF OSPF instance via CLI: use-dn=no