0

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?

Marko Farkas
  • 163
  • 3
  • 11

2 Answers2

0

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.

Mikhail Khirgiy
  • 2,003
  • 9
  • 7
-1

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

Arash
  • 274
  • 1
  • 8