Mikrotik routing and VLANs

mikrotikroutingvlan

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

You can achieve this by using routing marks in the mikrotik.

In the firewall you should assign a rule for each VLAN on the prerouting chain setting the action to the mark 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:

enter image description here

Now you can do routing marks:

enter image description here

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:

enter image description here

Remember to repeat the same for vlan2

Related Topic