Recursive static route does not apply MPLS labels

I previously posted about this in (http://forum.mikrotik.com/t/mpls-source-routing/113900/1), but realise that it was obscure.

I would really appreciate someone pointing out a mistake on my side, or whether this is a bug in RouterOS.


Simple network path where only edge routers run BGP and all routers talk OSPF (loopback IPs and point-to-point links) with MPLS LDP:

50.50.22.4 --> 50.50.22.2 --> 50.50.22.1
                   |
                   +-- default gateway --> 50.50.22.32

Working 100% - Pinging a host from 50.50.22.4, where the route’s recursive gateway is in the MPLS forwarding table:


Routing table contains iBGP route received from route reflector (50.50.22.6):

[admin@50.50.22.4] > /ip route print detail where dst-address=41.74.196.0/22
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 ADb  dst-address=41.74.196.0/22 pref-src=50.50.22.4 gateway=50.50.22.1
        gateway-status=50.50.22.1 recursive via 198.19.19.237 vlan10
        distance=200 scope=40 target-scope=30 bgp-as-path="37235"
        bgp-local-pref=198 bgp-origin=igp bgp-communities=64512:2000
        received-from=50.50.22.6

Nexthop is resolved using OSPF as an IGP:

[admin@50.50.22.4] > ip route print detail where dst-address=50.50.22.1/32
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=50.50.22.1/32 pref-src=50.50.22.4 gateway=198.19.19.237
        gateway-status=198.19.19.237 reachable via  vlan10
        distance=110 scope=20 target-scope=10 ospf-metric=320
        ospf-type=intra-area

Herewith the MPLS label path from 50.50.22.4, through 50.50.22.2 to 50.50.22.1:

[admin@50.50.22.4] > mpls forwarding-table print where destination=50.50.22.1/32
Flags: L - ldp, V - vpls, T - traffic-eng
 #   IN-LABEL   OUT-LABELS   DESTINATION     INTERFACE   NEXTHOP
 0 L 37120      4156         50.50.22.1/32   vlan10      198.19.19.237

[admin@50.50.22.2] > mpls forwarding-table print where destination=50.50.22.1/32
Flags: L - ldp, V - vpls, T - traffic-eng
 #   IN-LABEL   OUT-LABELS   DESTINATION     INTERFACE   NEXTHOP
 0 L 4156                    50.50.22.1/32   vlan1117    198.19.28.198

Trace route correctly shows the next hop as the MPLS switched destination (we don’t propagate TTL):

[admin@50.50.22.4] > tool traceroute 41.74.197.214
 # ADDRESS           LOSS SENT    LAST     AVG    BEST   WORST STD-DEV STATUS
 1 50.50.22.1          0%    2   0.7ms     0.8     0.7     0.9     0.1
 2 196.223.14.70       0%    2   0.7ms     0.8     0.7     0.9     0.1
 3 41.74.197.214       0%    1   1.8ms     1.8     1.8     1.8     1.8

Not working - Replacing the iBGP route with a static route:

I add a recursive static route for 41.74.196.0/22 via 50.50.22.1 and have adjusted the target-scope to be equal or larger than the scope of the route towards the recursive gateway:

/ip route
  add dst-address=41.74.196.0/22 distance=10 gateway=50.50.22.1 pref-src=50.50.22.4 target-scope=30

Route become active, as expected:

[admin@50.50.22.4] > /ip route print detail where dst-address=41.74.196.0/22
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  dst-address=41.74.196.0/22 pref-src=50.50.22.4 gateway=50.50.22.1 
        gateway-status=50.50.22.1 recursive via 198.19.19.237 vlan10 
        distance=10 scope=30 target-scope=30

 1  Db  dst-address=41.74.196.0/22 pref-src=50.50.22.4 gateway=50.50.22.1 
        gateway-status=50.50.22.1 recursive via 198.19.19.237 vlan10 
        distance=200 scope=40 target-scope=30 bgp-as-path="37235" 
        bgp-local-pref=198 bgp-origin=igp bgp-communities=64512:2000 
        received-from=50.50.22.6

Packets leaving the router do not have labels attached to them, so they follow the default gateway (incorrect):

[admin@50.50.22.4] > tool traceroute 41.74.197.214
 # ADDRESS           LOSS SENT    LAST     AVG    BEST   WORST STD-DEV STATUS                          
 1 50.50.22.2          0%    1   0.2ms     0.2     0.2     0.2       0                                 
 2 50.50.22.32         0%    1   0.3ms     0.3     0.3     0.3       0                                 
 3 50.50.22.1          0%    1   0.8ms     0.8     0.8     0.8       0                                 
 4 196.223.14.70       0%    1   0.8ms     0.8     0.8     0.8       0
 3 41.74.197.214       0%    1   1.4ms     1.4     1.4     1.4       0

PS: The packet follows the default route to 50.50.22.32, where it is subsequently forwarded to 50.50.21.1 using MPLS (essentially hairpins on 22.32).