policy routing and mangle

Hi,

If I have the following escenario,

R3
|
R4 ----- R2 ----- Subnets 10.10.1.0/20
10.10.2.0/20
10.10.3.0/20

and I want through policy routing with mangle route all subnets packets arriving to R2 to gateway R3, to do that i have configured R2 like this:

Rule 0

/ip firewall mangle add action=mark-routing new-routing-mark=to-R3 chain=prerouting

/ip route add gateway=R3(IP) routing-mark=to-R3

/ip route rule add src-address=10.10.0.0/16 table=to-R3 action=lookup

At the same time i want to route one specific IP per subnet that have as a destination address 192.168.0.0/16 to the gateway R4, to do that i have configured R2 like this:

Rule 1

/ip firewall mangle add action=mark-routing new-routing-mark=to-R4 chain=prerouting

/ip route add gateway=R4(IP) routing-mark=to-R4

/ip route rule add src-address=10.10.0.0/16 dst-address=192.168.0.0/16 table=to-R4 action=lookup

But these two rules do not route these specific IP per subnet to the desired R4 gateway, I thought that as in both cases the netmasks length are the same Rule 1 would be preferred over Rule 0 because the first one has more detailed information (src-address and dst-address) than the second one (only src-address) so I would like to know which is the method or rule used by RouterOS 3,7 to prioritize one rule over other one.
Also I would like to know what are the differences between setting the src-address and dst-address parameters in /ip route rule or /ip firewall mangle?
Thanks a lot,

way u don’t use basicaly router … ip route .. and set destination :smiley:

I forgot commenting that all routers are supposed to run OSPF and both R4 and R3 will have distribute-default = if-installed-as-type-1 and they are from different networks but connected through ethernet to give redundancy to both networks. So packets coming from R2 may pertain to R4 network or R3 network and in those two routers is where via policy routing and mangle i want to route packets statically to their own default internet gateway. So having this in mind i resend the questions i asked in the first post:

“But these two rules do not route these specific IP per subnet to the desired R4 gateway, I thought that as in both cases the netmasks length are the same Rule 1 would be preferred over Rule 0 because the first one has more detailed information (src-address and dst-address) than the second one (only src-address) so I would like to know which is the method or rule used by RouterOS 3,7 to prioritize one rule over other one.
Also I would like to know what are the differences between setting the src-address and dst-address parameters in /ip route rule or /ip firewall mangle?
Thanks a lot”