Mikrotik - Using 2 WAN connections with 2 Static IP addresses

29,199

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
Share:
29,199
Admin
Author by

Admin

Updated on August 29, 2020

Comments

  • Admin
    Admin almost 4 years

    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?