EDIT: Nevermind, while I still don't understand why this route was unreachable everything stops working when both sides are in an VRF. VRFs are really the biggest whack-a-mole ever. What I am actually trying to so is same as described in this question.
EDIT2: Solution to this particular question: 7.23.1 Resolvable route is unreachable. Did I find a bug or doing something wrong? - #6 by CGGXANNX . Turns out I also tried that already but what the issue is that the VRF has to be specified even if it's to be resolved in the same VRF. I was using the target VRF, not the source VRF
First off, I am setting up a maclan interface for inter-VRF communication (inspired by this post but I think in this case the detour over a non-local bogus IP isn't needed):
/interface bridge
add name=br-xvrf2 protocol-mode=none
/interface macvlan
add interface=br-xvrf2 mac-address=3E:8A:A1:C7:A6:08 name=xvrf-as
add interface=br-xvrf2 mac-address=16:B3:12:46:B8:C9 name=xvrf-main2
/ip address
add address=172.18.1.20/24 interface=xvrf-main2 network=172.18.1.0
add address=172.18.1.21/24 interface=xvrf-as network=172.18.1.0
/ip vrf
add interfaces=vlan55,vrrp55,xvrf-as name=vrf-as
In this instance, communication between VRF vrf-as and main VRF.
Let me first describe what works well and as expected: I can access a local service (wireguard and ssh) which is assigned to vrf-as from main VRF:
/ip route
add distance=1 dst-address=192.0.2.210/32 gateway=172.18.1.21
routing-table=main scope=30 target-scope=10
add disabled=no distance=1 dst-address=10.2.79.0/24 gateway=vlan3 routing-table=vrf-as scope=30 target-scope=10
In this case 192.0.2.210 is a local IP of RouterOS whose interface is in vrf-as. 10.2.79.0/24 is the LAN (vlan3) which is part of main VRF. Without these interfaces, a host in 10.2.79.0/24 is not able to reach 192.0.2.210 (because packets arrive in main VRF but 192.0.2.210 is in vrf-as). With this setup, any host from 10.2.79.0/24 can perfectly reach ssh/wireguard available on 192.0.2.210. Great!
Now I want to do the opposite as well: DNS is part of main VRF but should also be available from vlan55 (which is part of vrf-as):
/ip route
add distance=1 dst-address=10.2.79.2/32 gateway=172.18.1.20 routing-table=vrf-as scope=30 target-scope=10
Here 10.2.79.2 is RouterOS's own IP in main VRF. Note that above route command is identical to the one above (just IP flipped).
However, this route shows up as Unreachable!
/ip/route/print detail where dst-address=10.2.79.2/32 routing-table=vrf-as
Flags: D - DYNAMIC; X - DISABLED, I - INACTIVE, A - ACTIVE;
c - CONNECT, s - STATIC, r - RIP, b - BGP, o - OSPF, i - IS-IS, d - DHCP, v - VPN, m - MODEM, y - BGP-MPLS-VPN; H - HW-OFFLOADED; + - ECMP
27 Is dst-address=10.2.79.2/32 routing-table=vrf-as gateway=172.18.1.20 immediate-gw="" distance=1 scope=30 target-scope=10
This is crazy, because it's identical to the first working scenario for one and second, a connected route for 172.18.1.0/24 exists so it doesn't make sense at all that this route is unreachable! It is NOT.
For comparison, both scenarios, along with the connected routes:
/ip/route/print detail where (dst-address=10.2.79.2/32 or dst-address=172.18.1.0/24) and routing-table=vrf-as
Flags: D - DYNAMIC; X - DISABLED, I - INACTIVE, A - ACTIVE;
c - CONNECT, s - STATIC, r - RIP, b - BGP, o - OSPF, i - IS-IS, d - DHCP, v - VPN, m - MODEM, y - BGP-MPLS-VPN; H - HW-OFFLOADED; + - ECMP
27 Is dst-address=10.2.79.2/32 routing-table=vrf-as gateway=172.18.1.20 immediate-gw="" distance=1 scope=30 target-scope=10
DAc dst-address=172.18.1.0/24 routing-table=vrf-as gateway=xvrf-as@vrf-as immediate-gw=xvrf-as distance=0 scope=10 target-scope=5 local-address=172.18.1.21%xvrf-as@vrf-as
/ip/route/print detail where (dst-address=192.0.2.210/32 or dst-address=172.18.1.0/24) and routing-table=main
Flags: D - DYNAMIC; X - DISABLED, I - INACTIVE, A - ACTIVE;
c - CONNECT, s - STATIC, r - RIP, b - BGP, o - OSPF, i - IS-IS, d - DHCP, v - VPN, m - MODEM, y - BGP-MPLS-VPN; H - HW-OFFLOADED; + - ECMP
11 As ;;; xVRF2: Services on 192.0.2.210 accessible from main
dst-address=192.0.2.210/32 routing-table=main gateway=172.18.1.21 immediate-gw=172.18.1.21%xvrf-main2 distance=1 scope=30 target-scope=10
DAc dst-address=172.18.1.0/24 routing-table=main gateway=xvrf-main2 immediate-gw=xvrf-main2 distance=0 scope=10 target-scope=5 local-address=172.18.1.20%xvrf-main2
Did I hit yet another RouterOS VRF bug or is there anything wrong?
PS:
/ip/arp/print where address=172.18.1.20 or address=172.18.1.21
Flags: D - DYNAMIC; C - COMPLETE
Columns: ADDRESS, MAC-ADDRESS, INTERFACE, VRF, STATUS
ADDRESS MAC-ADDRESS INTERFACE VRF STATUS
1 DC 172.18.1.21 3E:8A:A1:C7:A6:08 xvrf-main2 main stale
0 DC 172.18.1.20 16:B3:12:46:B8:C9 xvrf-as vrf-as stale