2

I have 2 WAN lines that connect to the Internet: one connects on ether1 interface, the other connect on ether2 interface, using a Mikrotik router.

ether3 connects to LAN.

Each line has Valid IP (static IP) and connect with PPPoE connection:

  • WAN 1 has 217.219.xx.xx, connecting with pppoe1-WAN
  • WAN 2 has 89.165.xx.xx connecting with pppoe1-WAN2

In Routing, pppoe1-WAN1 has Distance 1 and pppoe1-WAN2 has Distance 2

When WAN1 is Disabled, I can use 89.165.xx.xx to connect to router from out of office but when WAN1 is enabled I can not connect with 89.165.xx.xx.

Can anyone help me to fix this problem?

RichVel
  • 7,030
  • 6
  • 32
  • 48
leili
  • 81
  • 1
  • 2
  • 6

2 Answers2

4

Your solution is in the mangle setup - use the lines below to add mangle actions:

/ip firewall mangle
add action=mark-connection chain=input comment=WAN1 in-interface=\
    pppoe-Wan1 new-connection-mark=MWAN1
add action=mark-routing chain=output connection-mark=MWAN1 new-routing-mark=\
    RWAN1 passthrough=no
add action=mark-connection chain=forward comment=WAN1PF connection-state=new \
    in-interface=pppoe-Wan1 new-connection-mark=PFMWAN1
add action=mark-routing chain=prerouting connection-mark=PFMWAN1 \
    in-interface=ehter3 new-routing-mark=RWAN1
add action=mark-connection chain=input comment=WAN2 in-interface=pppoe-WAN2 \
    new-connection-mark=MWAN2
add action=mark-routing chain=output connection-mark=MWAN2 new-routing-mark=\
    RWAN2 passthrough=no
add action=mark-connection chain=forward comment=WAN2PF connection-state=new \
    in-interface=pppoe-WAN2 new-connection-mark=PFMWAN2
add action=mark-routing chain=prerouting connection-mark=PFMWAN2 \
    in-interface=ehter3 new-routing-mark=RWAN2

Then add this route in the route setup:

/ip route
add distance=1 gateway=pppoe-WAN2 routing-mark=RWAN2
add distance=1 gateway=pppoe-WAN1 routing-mark=RWAN1
RichVel
  • 7,030
  • 6
  • 32
  • 48
Mehdi Haghshenas
  • 2,433
  • 1
  • 16
  • 35
  • 1
    It would be great to have some explanation of what the actions are doing here - seems like there are 4 actions for each WAN interface. – RichVel Aug 28 '17 at 13:34
0

this is very good, for the gateways with ip address like 192.168.xxx.xxx it is good to replace "gateway=pppoe-WAN1" with "gateway=192.168.xxx.xxx" on this rule:

add distance=1 gateway=pppoe-WAN1 routing-mark=RWAN1
Petter Friberg
  • 21,252
  • 9
  • 60
  • 109