Community discussions

MikroTik App
 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Load Balancing with 3 wan

Mon Dec 20, 2010 10:39 am

Hi,

I have 3 mode of connections.
1) DSL 20 Mb
2) Wimax 2 Mb
3) V-sat 2 Mb

I need to use Loadbalancing and failover. The problem i have is, dsl modem ip is 192.168.1.1. If the dsl isdown, the gateway ip is reachable and it will not do the failover.

Any body know how to solve this?


Regards,

Aslam
 
User avatar
bysard
Member Candidate
Member Candidate
Posts: 295
Joined: Thu Apr 22, 2010 2:53 pm

Re: Load Balancing with 3 wan

Mon Dec 20, 2010 10:52 am

Try to ping the gateway directly, not DSL modem and put static IP route for that gateway(ip) through the correct interface, so it will only transfer data throug wanted gateway. So if the gateway is down, it will switch to the next distance gateway.
 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Mon Dec 20, 2010 11:11 am

Its not clear for me.

What i did is, my gateway im MT for the dsl is 192.168.1.1 and put the option check gateway to ping. Is it right?


Regards,

Aslam
 
User avatar
bysard
Member Candidate
Member Candidate
Posts: 295
Joined: Thu Apr 22, 2010 2:53 pm

Re: Load Balancing with 3 wan

Mon Dec 20, 2010 11:17 am

Yes it is, but you are pinging the wrong IP. you are pinging the local IP of the modem/router when you should be actually pinging the DSLAM ip on the other side. Also for that IP you need a static route that goes through this gateway (DSL).
 
infidel
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Wed Oct 07, 2009 5:30 pm

Re: Load Balancing with 3 wan

Mon Dec 20, 2010 11:53 am

 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Mon Dec 20, 2010 2:10 pm

Hi,

Could you please explain me, where do i can configure the ip to ping.


Aslam
 
infidel
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Wed Oct 07, 2009 5:30 pm

Re: Load Balancing with 3 wan

Mon Dec 20, 2010 3:53 pm

:local Gateways "192.168.1.1,192.168.2.254"

These are the ips of the modems you want to monitor. Inyour case is only 1.

:local Gateways "192.168.1.1"

:local pingip [:resolve "sex.com"]

This is the domain you will use to check if you have internet. Make sure it is something that replies to pings, is always up (like google) but is not accessed by your customers (not like google).
 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 10:24 am

Can somebody help me how to do the scripting for this scenario!!!

I'm tried some scripting http://wiki.mikrotik.com/wiki/ECMP_Failover_Script but no sucess. There is lot of errors
My MT version is 4.11 and most of the scripting tutorials are based on 3.XX

BTW there is no good scripting tutorials for the beginners.


Regards,

Aslam
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7198
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 10:49 am

 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 12:09 pm

Applogize my illiterate.

In all the documents, it is not clear where the scripts has to apply.
Is it possible via Winbox?
It it is on CLI, do i can type directly? or type in notepad and put it in the file?

Regards,

Aslam
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7198
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 12:45 pm

Second sentence in the manual:

"Scripts can be stored in Script repository or can be written directly to console. The events used to trigger script execution include, but are not limited to the System Scheduler, the Traffic Monitoring Tool, and the Netwatch Tool generated events. "

And of course you can add scripts from winbox. Go to System->Script and add new scripts.
 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 2:23 pm

Hi,

See the errors i'm getting,

admin@MikroTik] /system script> add name="ecmp-startup" source=":if \(\[/ping 82.205.224.9 count=1\]=1 && \
syntax error (line 1 column 40)
[admin@MikroTik] /system script> \[/ping 82.205.224.1 count=1\]=1 && \[/ip route get \[find \
expected command name (line 1 column 4)
[admin@MikroTik] /system script> comment=\"ECMP Route For HTTP\"\] disabled\]=true\) do={ :log info \"Both gateways up" \
syntax error (line 1 column 11)
[admin@MikroTik] /system script> \n/ip route set \[find routing-mark=ecmp-http-route\] \
expected command name (line 1 column 4)
[admin@MikroTik] /system script> disabled=no}" policy=ftp,reboot,read,write,policy,test,winbox,password
syntax error (line 1 column 12)
[admin@MikroTik] /system script> add name="ecmp-shutdown" source=":if \(\[/ping 82.205.224.9 count=1\]=1 && \
syntax error (line 1 column 41)
[admin@MikroTik] /system script> \[/ping 82.205.224.1 count=1\]=0\) do={ :log info \"Gateway down"\
expected command name (line 1 column 4)
[admin@MikroTik] /system script> \n/ip route set \[find routing-mark=ecmp-http-route\] \
expected command name (line 1 column 4)
[admin@MikroTik] /system script> disabled=yes}" policy=ftp,reboot,read,write,policy,test,winbox,password
syntax error (line 1 column 12)
[admin@MikroTik] /system script>


I'm trying this on 4.11. and from the tutorial http://wiki.mikrotik.com/wiki/ECMP_Failover_Script


Regards,

Aslam
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7198
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 5:10 pm

/ system script 
   add name="ecmp-startup" source=":if ([/ping 1.1.1.12 count=1]=1 && \
   [/ping 1.1.1.13 count=1]=1 && [/ip route get [find \
   comment=\"ECMP Route For HTTP\"] disabled]=true) do={ :log info \"Both gateways up\" \
   \n/ip route set [find routing-mark=ecmp-http-route] \
   disabled=no}" policy=ftp,reboot,read,write,policy,test,winbox,password 
   add name="ecmp-shutdown" source=":if ([/ping 1.1.1.12 count=1]=1 && \
   [/ping 1.1.1.13 count=1]=0) do={ :log info \"Gateway down\"\
   \n/ip route set [find routing-mark=ecmp-http-route] \
   disabled=yes}" policy=ftp,reboot,read,write,policy,test,winbox,password
 
infidel
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Wed Oct 07, 2009 5:30 pm

Re: Load Balancing with 3 wan

Tue Dec 21, 2010 9:17 pm

This script will not work in your case...
 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Wed Dec 22, 2010 9:00 am

Does anybody made script working with 4.11? or else i have to giveup the idea for the scripting.


Aslam
 
aslu
newbie
Topic Author
Posts: 36
Joined: Mon Apr 13, 2009 3:22 pm

Re: Load Balancing with 3 wan

Wed Dec 22, 2010 1:52 pm

I found the solution. It is very simple.

I use Netwatch to ping a IP and put the static route for the this IP via DSL.
Added one more Netwatch with different ip and put the static route for the IP via V-sat.

Whenver the IP is not reachable, it will disable the corresponding default route.

Regards,

Aslam
 
infidel
Frequent Visitor
Frequent Visitor
Posts: 83
Joined: Wed Oct 07, 2009 5:30 pm

Re: Load Balancing with 3 wan

Wed Dec 22, 2010 7:05 pm

Which is exactly what my script does with the only difference that it uses 1 ip address which rotates for all gateway checks. It also checks if the modem is connect before pinging and logs all errors to a seperate log. Anyway, glad you figured it out!