Policy Routing in RouterOS 3.x
Using mangle is not required for policy (aka static) routing with RouterOS 3.x. This is an example of routing between networks without using mangle.
The example network setup:
File:RouterOS 3 policy routing example network.png
Static routes and rules must be added to tell router1 that the 192.168.22.0/24 subnet is accessible via router2 and to tell router2 that the 192.168.20.0/24 subnet is accessible through router1.
Note: For this particular example, adding the /ip route rule is not required on neither of the routers and does not achieve anything. --Route 16:14, 28 December 2009 (UTC)
On router1:
/ip address add address=192.168.20.1/24 interface=ether2 /ip address add address=192.168.21.1/24 interface=ether1 /ip route add dst-address=192.168.22.0/24 gateway=192.168.21.2 disabled=no /ip route rule add dst-address=192.168.22.0/24 action=lookup table=main
yields the following routing table from /ip route print
# DST-ADDRESS PREF-SRC GATEWAY-STATE GATEWAY DISTANCE INTERFACE 0 ADC 192.168.20.0/24 192.168.20.1 0 ether2 1 ADC 192.168.21.0/24 192.168.21.1 0 ether1 2 A S 192.168.22.0/24 reachable 192.168.21.2 1 ether1
On router2:
/ip address add address=192.168.21.2/24 interface=ether3 /ip address add address=192.168.22.1/24 interface=wlan1 /ip route add dst-address=192.168.20.0/24 gateway=192.168.21.1 disabled=no /ip route rule add dst-address=192.168.20.0/24 action=lookup table=main
yields the following from /ip route print
# DST-ADDRESS PREF-SRC GATEWAY-STATE GATEWAY DISTANCE INTERFACE 0 A S 192.168.20.0/24 reachable 192.168.21.1 1 ether3 1 ADC 192.168.21.0/24 192.168.21.2 0 ether3 2 ADC 192.168.22.0/24 192.168.22.1 0 wlan1
Now client1 can ping client2.