Hi guys!
Thank you anav for this https://forum.mikrotik.com/viewtopic.php?t=182373
I have problems communicating between interfaces when using policy routing the “new” ros7 way
The goal here is to route vlan5 and vlan40 over WAN2 (ether6 with gateway Y.Y.Y.Y) and retaining communication between interfaces if wanted.
/interface vlan
add interface=bridge1 name=vlan1 vlan-id=1
add interface=bridge1 name=vlan5 vlan-id=5
add interface=bridge1 name=vlan10 vlan-id=10
add interface=bridge1 name=vlan30 vlan-id=30
add interface=bridge1 name=vlan40 vlan-id=40
add interface=bridge1 name=vlan50 vlan-id=50
/interface list
add name=WAN
add name=LAN
add name=GUESTS
add name=BACKUP
/interface list member
add interface=ether1 list=WAN
add interface=ether6 list=WAN
add interface=vlan10 list=GUESTS
add interface=vlan30 list=GUESTS
add interface=vlan50 list=GUESTS
add interface=vlan40 list=BACKUP
add interface=vlan5 list=BACKUP
/routing table
add disabled=no fib name=backup
/ip firewall address-list
add address=192.168.5.0/24 list=BACKUP
add address=192.168.40.0/24 list=BACKUP
add address=172.16.1.0/24 list=connectedSubnets
add address=192.168.5.0/24 list=connectedSubnets
add address=192.168.40.0/24 list=connectedSubnets
Simple routes with failover:
/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
X.X.X.X pref-src="" routing-table=main scope=30 \
suppress-hw-offload=no target-scope=10
add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=Y.Y.Y.Y \
pref-src="" routing-table=main scope=30 suppress-hw-offload=no \
target-scope=10
add check-gateway=ping disabled=no distance=10 dst-address=0.0.0.0/0 gateway=\
Y.Y.Y.Y pref-src="" routing-table=backup scope=30 \
suppress-hw-offload=no target-scope=10
add disabled=no distance=20 dst-address=0.0.0.0/0 gateway=X.X.X.X \
routing-table=backup suppress-hw-offload=no
I wanted to implement policy routing this way but I’m unable to get a connection between the interfaces then …
/routing rule
add action=lookup disabled=no interface=vlan5 table=backup
add action=lookup disabled=no interface=vlan40 table=backup
The following mangle rules are working (ros6 variant):
/ip firewall mangle
add action=accept chain=prerouting dst-address-list=connectedSubnets \
src-address-list=connectedSubnets
add action=mark-connection chain=prerouting connection-mark=no-mark \
connection-state="" in-interface=ether6 new-connection-mark=wan-backup \
passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type="" new-connection-mark=wan-backup passthrough=yes \
src-address-list=BACKUP
add action=mark-routing chain=prerouting dst-address-type="" \
in-interface-list=BACKUP new-routing-mark=backup passthrough=yes
add action=mark-routing chain=output connection-mark=wan-backup \
new-routing-mark=backup passthrough=yes
The whole magic does the line where I exclude connectedSubnets to connectedSubnets from being mangled.
Is there a better/leaner/nicer way using the ros7 variant without mangle rules?