Different Subnets... Different gateways...

I have a situation:

2 Local subnets (Subnet1 and Subnet2) need to access the internet through the same MT PC, yet using different gateways.
Required to set Routing to direct each Local IP range to the Correct Gateway.

Setup ot the MT Unit: 1 Wlan and 1 Ethernet
The WLAN is in bridge mode with (dynamic)WDS enabled on Bridge1.
The Bridge1 Interface has Ether1 and WDS(dynamic) as ports.
Ether1 connects to a switching-hub. To this hub connects PC1 and two Internet Routers(Gateways) (Router1 and Router2)

PC1 has an IP on the same range as Subnet1.
There are 4 IP addresses set to Interface Bridge1 on the MT unit:
IP1 is the gateway of local Subnet1
IP2 is the gateway of local subnet2
IP3 is on the same range as Router1
IP4 is on the same range as Router2

Masquerade: Two rules set: One for srcaddress=subnet1 and one for srcaddress=subnet2

Routing Marks:
In Mangle two routing marks are set: One for srcaddress=subnet1 (Routing Mark=Subnet1Route)
and one for srcaddress=subnet2 (Routing-Mark=Subnet2Route)

In IP Routes:

Setting1
Two routes set:
Routing Mark = Subnet1Route => gateway = Router1 IP
Routing Mark = Subnet2Route => gateway = Router2 IP

Setting2
Alternative setup:
Default Gateway => Router1 IP
Routing Mark = Subnet2Route => gateway = Router2 IP

In Both settings, the gateway allocation works correctly.

Problem
In Both settings, PCs from different subnets can access each other until the routing rules are enabled.
In the Setting1, PC1 can access subnet1 until the routing rules are enabled. In the second setting, PC1 can access subnet1.

Any advice? Any better approach for gateway allocation? Thx

Set the routing marks not only depending on the source-address but also on the destination-address, that is only set the subnet1 routing mark if the destination-address is not in subnet2 and set the subnet2 routing mark only if the destination-address is not in subnet1. Something like

add chain=prerouting action=mark-routing new-routing-mark=subnet1route passthrough=yes src-address={SUBNET1_HERE} dst-address=!{SUBNET2_HERE}

–Tom

Thx Tom… Will try and report.

http://wiki.mikrotik.com/wiki/Policy_Routing_in_RouterOS_2.9.x

Wonder what the 3rd rule is for? Lookup?

Thx again Tom.

Tried your suggestion.
PC1 is now able to access Subnet1, but not Subnet2, even when the MT IP is set as gateway for PC1. Masquerading applied.

Yet, we need to know is there a working way in MT where we can allocate two different gateways to two different subnets respectively, and through only one bridge interface?

This option should work fine

Default Gateway => Router1 IP
Routing Mark = Subnet2Route => gateway = Router2 IP; !subnet1

Use IP route with routing mark, and add the third rule in your ip routes rules - routing mark=table, action lookup