Lan and WLan on 2 different routers?

Hi, my RB951G-2HnD is configured like a router:

  • port 1 wan
  • bridge with port 2, 3, 4 , 5, wlan1
  • dhcp, masquerade (nat) and a static route (the gateway)

Anyway, on wan port arrive 2 different vlans: a default untagged vlan (the one I’m using) and a tagged vlan.
So, I added a second masquerade rule and a second static route to use the second tagged vlan.

And I saw that only one gateway can be active. So, according to which one gateway I want to activate, I can surf with first or second vlan (that have different public ip).

My wish is to route the LAN traffic to the default untagged vlan and route the WLAN traffic to the tagged vlan.

Any tip?

Thanks in advance, Simone.

use mangle table, pre-routing chain:

connection mark all new connections that come in on wan, or tagged wan (I’ll call it wan2 from here on)
mark wan1 connections = wan1, wan 2 connections = wan2. (obviously)
Mark new connections arriving on each LAN interface with the connection mark you wish to force the traffic onto.

Then after these connection mark rules, you have another set of rules that check for connection-mark = wan1, action = mark routing → wan1 / connection-mark = wan2, mark routing → wan2

Then put these same two rules in the output chain of mangle table as well.

Then in the IP routes - make sure the default GW route for wan1 has routing mark = wan1, and the default GW route for wan2 has routing mark = wan2