I have setup two VLANs on one Mirkotik router. Both VLAN0 and VLAN1 have their WAN ports. WAN1 (VLAN0) is connected to network 1 and WAN2 (VLAN1) is connected to network 2.
I want to:
- route the traffic from VLAN0 via WAN1 to net1
- and from VLAN1 via WAN2 to net2
…but there is a routing problem. Only one routing table exist, and only one default route for both VLAN0 and 1 can be set up.
Can I somehow create different routes for both VLANs?
Best Answer
In the firewall you should assign a rule for each VLAN on the
prerouting chain
setting the action to themark routing
, but prior to this action, you should mark packets which are coming through the vlan interfaces.so First you mark the packets like this:
Now you can do routing marks:
At the moment I have created a routing mark ('lookup table') named "vlan1-routing". So I can set a rule in
route
with the configured marks, like this: