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?

  • What do you want to achieve with two WANs ? failover ? load balancing ? – Benoit PHILIPPON Feb 16 '17 at 20:40

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


Any router isn't needed to assign static routes for directly connected networks. You have two ways.

  1. You assign WAN1 ip addres as default gateway for all hosts from net1. Then you assign WAN2 ip addres as default gateway for all hosts from net2.

  2. Add static route option to DHCP servers for both networks net1 and net2. But this method is difficult and not all operational systems can understand this dhcp options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.