I have two WAN connection and two LAN connection.
WAN1 - > x
WAN2 - > y
LAN1 → 192.168.0.0/24
LAN2 → 192.168.1.0/24
Also I have load balancing…
But I want LAN2 to use only WAN2 connection!
How can i do that?
You will need to configure policy based routing (PBR) in Mangle.
I suggest looking through the wiki and the forums, there are plenty of Mangle examples for PBR.
Thanks! I reviewed for PBR and I try this in my scenarie:
ip firewall Mangle add chain=prerouting src-address=192.168.0.0/24 action=mark-routing new-routing-mark=ThroughOnly_WAN2
Ip Route Add Dst-Address=0.0.0.0/0 Gateway=y(ip gate) Routing-Mark=ThroughOnly_WAN2
ip firewall nat chain=srcnat src-address=192.168.0.0/24 out-interface=WAN2 action=masquerade
How it looks to you?
You need to do Mangle like this:
/ip firewall mangle
add chain=prerouting src-address=192.168.0.0/24 connection-mark=no-mark action=mark-connection new-connection-mark=ThroughOnly_WAN2
add chain=prerouting src-address=192.168.0.0/24 connection-mark=ThroughOnly_WAN2 action=mark-routing new-routing-mark=ThroughOnly_WAN2You will also want to do more in Mange than just that.
For example, correctly handle WAN->Router and WAN->LAN connections.
Look at this presentation, it should explain everything:
https://youtu.be/67Dna_ffCvc
Feel free to skip to around 6:30 - that’s when the Mangle stuff starts.