-2

I want to create isolated network on mikrotik without load balancing . Ex:
Wan1 : 88.88.88.88
Wan2 : 99.99.99.99
Lan1 : 192.168.1.0/24
Lan2 : 192.168.2.0/24
Lan1 go to internet via Wan1 and Lan2 go to internet via Wan2.Mikrotik mangle and route config as follows. When I use this config I never see wan2 on whatismyip. I see wan1 ip on lan1 and lan2 both.(packet-mark is for queue)

/ip firewall mangle
add action=mark-routing chain=prerouting comment=Wan1_Routing hotspot=auth \
    new-routing-mark=Wan1 passthrough=no src-address=172.1.0.0/20 \
    src-address-list=Wan1
add action=mark-routing chain=prerouting comment=Wan2_Routing hotspot=auth \
    new-routing-mark=Wan2 passthrough=no src-address=172.5.0.0/21 \
    src-address-list=Wan2
add action=mark-packet chain=prerouting comment=Wan1_Up in-interface=Wan1 \
    new-packet-mark=Wan1_Up passthrough=no src-address-list=Wan1
add action=mark-packet chain=postrouting comment=Wan1_Dwn dst-address-list=\
    Wan1 new-packet-mark=Wan1_Dwn out-interface=Wan1 passthrough=no
add action=mark-packet chain=prerouting comment=Wan2_Up in-interface=Wan2 \
    new-packet-mark=Wan2_Up passthrough=no src-address-list=Wan2
add action=mark-packet chain=postrouting comment=Wan2_Dwn dst-address-list=Wan2 \
    new-packet-mark=Wan2_Dwn out-interface=Wan2 passthrough=no
/ip route
add distance=1 gateway=192.168.1.1 routing-mark=Wan1
add distance=1 gateway=192.168.2.1 routing-mark=Wan2
add distance=1 gateway=192.168.1.1
add distance=1 gateway=192.168.2.1
Erdem Çetin
  • 491
  • 1
  • 5
  • 21

1 Answers1

0

Use the Per Connection Classifier to achieve this, in three steps.

  • step 1: mark connections with firewall/mangle feature; i.e. 192.168.1.0/24 clients will get "LAN1" connection mark
  • step 2: mark packets with correct route using firewall/mangle; i.e. "LAN1" connections will get "route_WAN1" route mark.
  • step 3: create two routes in ip/route to handle "route_WAN1" and "route_WAN2" packets and forward them to the corresponding gateway.

And that's all. Detailed implementation can be found here: http://wiki.mikrotik.com/wiki/Manual:PCC