107. Mikrotik Load Balancing(ECMP Method) 2 WANs(Static IP)


You can contact me: plus.google.com/+PhallaCCMT; youtube.com/phallaccmt; facebook.com/Phalla.CCMT; twitter.com/PhallaCCMT and Phalla.CCMT@gmail.com

Script:

/ip address
add address=192.168.168.1/24 interface=bridge-LAN network=192.168.168.0
add address=103.28.0.254/30 interface=WAN2 network=103.28.0.252
add address=103.28.2.254/30 interface=WAN1 network=103.28.2.252

/ip dns
set  servers=8.8.8.8,8.8.4.4

/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2

/ip route
add check-gateway=ping distance=1 gateway=103.28.0.253,103.28.2.253


Ref: http://wiki.mikrotik.com/wiki/ECMP_load_balancing_with_masquerade


Other Config

/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2

/ip firewall mangle
add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=\
    WAN1_Conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=\
    WAN2_Conn passthrough=yes
add action=mark-routing chain=output connection-mark=WAN1_Conn \
    new-routing-mark=WAN1_Conn passthrough=no
add action=mark-routing chain=output connection-mark=WAN2_Conn \
    new-routing-mark=WAN2_Conn passthrough=no

/ip route
add distance=1 gateway=103.28.2.253 routing-mark=WAN1_Conn
add distance=1 gateway=103.28.0.253 routing-mark=WAN2_Conn
add check-gateway=ping distance=1 gateway=103.28.0.253,103.28.2.253


Previous
Next Post »

5 comments

Write comments
Narreach
AUTHOR
January 14, 2017 at 10:40 AM delete

I have 1 question. I have wan1 is ezecom and wan2 is opennet, i use ezecom as pppoe and opennet none.i use it as load sharing and no any condition just when want1 is loss wan2 will share internet on my lan.but i forward my telephone system ip to wan1 with public ip that i got from ezecom. but the problem mikrotik refresh load sharing every 10 minutes and my telephone system is sometime redirect to wan2 that make confuse connection with my ip phnone from my branch from another province that point to my system at PP. so how can i make my ip of my telephone system always use wan1 path only not redirect to wan2 path that have no public ip. anymore detail can contact me : nareachkr@gmail.com. thanks hope you can help me.

Reply
avatar
NSB
AUTHOR
February 27, 2017 at 1:58 PM delete

Hi Phalla

What do you mean "Other Config"?
Did you mean There are 2 ways in ECMP Method? If so What is the best?

Reply
avatar
Unknown
AUTHOR
March 6, 2017 at 3:21 AM delete

what is the diferennce between both of them ?

Reply
avatar
Unknown
AUTHOR
October 13, 2017 at 6:37 PM delete

I tried without the mangle rules and it woks fine but I want to know why in some tutorials the mangle rule is added , just like you have indicated here as other config

Reply
avatar
Unknown
AUTHOR
March 5, 2018 at 9:57 PM delete

please, can you post or send the complete configuration?

Reply
avatar