Best method to load balance 2 internet line?

hi all i asked for the best method to loadbalance two internet line each one is 4 M
1- pcc or
2-nth
i have mk ver 3.30
please help me to choose the better way

PCC is better.

thanks for you
what a bout NTH
I want to know the advantages of each method

PCC can behave like Nth, and can do balancing in smarter way (depending on classifier)
PCC don’t waste connection-mark, so you can use it for other purposes

does anybody knows advantages of Nth? except it works on v3.20 :smiley:

Hi Chupaka! My problem with PCC is that I need a script to watchdog my ADSL lines, and if one line have problems reconfigure the PCC to avoid problems with the connections.
Do you have something made to solve this?

thanks!

AFAIR, there were such script posted about a month ago or something…

Just mark your connections using PCC and then put a routing mark on them.
Then add default backup routes for all the different routing marks with a higher distance over the other DSL lines.

If there are troubles with your DSL just disable your PPPOE client (or interface) and PCC will work over the other lines.

This don’t work, becaume my adsl routers will be connected with my routeros and this conection will work, but not my pppoe in router.

So how do you decide your ADSL connection has problems ? You want to ping something or … ?

http://forum.mikrotik.com/t/solved-script-to-recreate-the-load-balance-mangle-rules/36203/1

this is a post with the script, but I think this is using pppoe in the routeros. My networks use other routers that make the pppoe connections.

thanks,

Void,

I decide if my adsl works if my pings works across this “ADSL1” line. You can test it with a ping using out-interface for this ping ADSL1 or ADSL2, etc..

I used this BIG script for NTH months ago.. to make this, but is not inmediatly. You have to run every 5 minutes or so, and you could have your system this time working bad. This is for 2 lines, for 4 lines you need 16 scripts to work like this.. SORRY FOR THE \n and \r but I copy paste my rsc.



/system script
add name=TESTADSLSCRIPT policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff source="#SCRIPT MI\
    RAR ESTADO ADSLs#\r\
    \n\r\
    \n#set variables\r\
    \n:local pingcount 3\r\
    \n:local ipA 192.168.7.2\r\
    \n#ADSL1\r\
    \n:local GatewayA 192.168.7.1\r\
    \n:local ipB 192.168.8.2\r\
    \n#ADSL2\r\
    \n:local GatewayB 192.168.8.1\r\
    \n:local website www.google.com\r\
    \n\r\
    \n\r\
    \n#ping gateways with src\r\
    \n:local pingresultA [/ping \$website src-address=\$ipA count=\$pingcount]\
    \r\
    \n:local pingresultB [/ping \$website src-address=\$ipB count=\$pingcount]\
    \r\
    \n\r\
    \n\r\
    \n:if ((\$pingresultA=0) && (\$pingresultB>0)) do={ /system script run ADS\
    L1FALLA; :log warning \" Falla ADSL1\" }\r\
    \n\r\
    \n:if ((\$pingresultA>0) && (\$pingresultB=0)) do={ /system script run ADS\
    L2FALLA; :log warning \" Falla ADSL2\" }\r\
    \n\r\
    \n:if ((\$pingresultA=0) && (\$pingresultB=0)) do={ /system script run FAL\
    LANTODASADSL; :log warning \" Fallan todas las ADSL\" }\r\
    \n\r\
    \n:if ((\$pingresultA>0) && (\$pingresultB>0)) do={ /system script run FUN\
    CIONANTODASADSL; :log info \" Funcionan todas las ADSL\" }\r\
    \n"
add name=FUNCIONANTODASADSL policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff source="#SCRIPT SI\
    LAS DOS FUNCIONAN BIEN#\r\
    \n:local GatewayA 192.168.7.1\r\
    \n:local GatewayB 192.168.8.1\r\
    \n/ip firewall mangle set [find comment=\"ADSL1 CONN\"] disabled=no;\r\
    \n/ip firewall mangle set [find comment=\"ADSL2 CONN\"] disabled=no;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL1GW\"] di\
    sabled=no;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL2GW\"] di\
    sabled=no;\r\
    \n/ip firewall mangle set [find comment=\"Conexiones del router de la red1\
    \"] disabled=no;\r\
    \n/ip firewall mangle set [find comment=\"Paquetes del router de la red1\"\
    ] disabled=no;\r\
    \n/ip firewall mangle set [find comment=\"Conexiones del router de la red2\
    \"] disabled=no;\r\
    \n/ip firewall mangle set [find comment=\"Paquetes del router de la red2\"\
    ] disabled=no;\r\
    \n/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR1\"\
    ] gateway=\$GatewayB;\r\
    \n/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR2\"\
    ] gateway=\$GatewayA;\r\
    \n:log info \"Se ha ejecutado el script de 2 ADSL ok\";\r\
    \n"
add name=FALLANTODASADSL policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff source="#SCRIPT SI\
    LAS DOS ADSL FALLAN#\r\
    \n:local GatewayA 192.168.7.1\r\
    \n:local GatewayB 192.168.8.1\r\
    \n/ip firewall mangle set [find comment=\"ADSL1 CONN\"] disabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"ADSL2 CONN\"] disabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL1GW\"] di\
    sabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL2GW\"] di\
    sabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Conexiones del router de la red\
    1\"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Paquetes del router de la red1\
    \"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Conexiones del router de la red\
    2\"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Paquetes del router de la red2\
    \"] disabled=yes;\r\
    \n#/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR1\
    \"] gateway=\$GatewayB;\r\
    \n#/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR2\
    \"] gateway=\$GatewayB;\r\
    \n:log info \"Se ha ejecutado el script de ADSLs FALLAN\";\r\
    \n/system script run ERROR;"
add name=ADSL1FALLA policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff source="#SCRIPT SI\
    ADSL1 FALLA#\r\
    \n:local GatewayA 192.168.7.1\r\
    \n:local GatewayB 192.168.8.1\r\
    \n/ip firewall mangle set [find comment=\"ADSL1 CONN\"] disabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"ADSL2 CONN\"] disabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL1GW\"] di\
    sabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL2GW\"] di\
    sabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Conexiones del router de la red\
    1\"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Paquetes del router de la red1\
    \"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Conexiones del router de la red\
    2\"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Paquetes del router de la red2\
    \"] disabled=yes;\r\
    \n/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR1\"\
    ] gateway=\$GatewayB;\r\
    \n/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR2\"\
    ] gateway=\$GatewayA;\r\
    \n:log info \"Se ha ejecutado el script de ADSL1 FALLA\";\r\
    \n/system script run ERROR;"
add name=ADSL2FALLA policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff source="#SCRIPT SI\
    ADSL2 FALLA#\r\
    \n:local GatewayA 192.168.7.1\r\
    \n:local GatewayB 192.168.8.1\r\
    \n/ip firewall mangle set [find comment=\"ADSL1 CONN\"] disabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"ADSL2 CONN\"] disabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL1GW\"] di\
    sabled=yes;\r\
    \n/ip firewall mangle set [find comment=\"Marca la ruta como ADSL2GW\"] di\
    sabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Conexiones del router de la red\
    1\"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Paquetes del router de la red1\
    \"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Conexiones del router de la red\
    2\"] disabled=yes;\r\
    \n#/ip firewall mangle set [find comment=\"Paquetes del router de la red2\
    \"] disabled=yes;\r\
    \n/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR1\"\
    ] gateway=\$GatewayA;\r\
    \n/ip route set [find comment=\"TRAFICO DEL ROUTER Y TRAFICO SIN MARCAR2\"\
    ] gateway=\$GatewayB;\r\
    \n:log info \"Se ha ejecutado el script de ADSL2 FALLA\";\r\
    \n/system script run ERROR;"

Martin, on PL MUM, Valens said something about ‘scope’ and ‘target-scope’ for checking remote addresses… maybe one should ask him for details? =)

yes,

I talked with Valens and I did tests here in the office, but I didn’t arrive to nothing.

What mxena said is that I can ping to google and microsoft (or whatever “always” will work) and mark this ping destinations with a routing mark.. and then, as this pings always should use the same ADSL route.. in my case ADSL1 or ADSL2, then I can use the watchdog to enable or disable rules for PCC with up and down scripts. Do you understand what I try to do?

huhuh! real-life testing required, but in the lab all seems fine…

let’s suppose we have 192.168.1.1 as a modem1 address, 192.168.2.1 as a modem2 address. 1.1.1.1 and 2.2.2.2 are fake addresses - they don’t exists nowhere, are used only for recursive routing building

we’ll check using 213.180.204.3 and 93.158.134.3 (those are ya.ru website)

/ip route
add dst-address=213.180.204.3/32 gateway=192.168.1.1 scope=10 target-scope=10
add dst-address=93.158.134.3/32 gateway=192.168.2.1 scope=10 target-scope=10
add dst-address=1.1.1.1/32 gateway=213.180.204.3 scope=30 target-scope=10 check-gateway=ping
add dst-address=2.2.2.2/32 gateway=93.158.134.3 scope=30 target-scope=10 check-gateway=ping
add gateway=1.1.1.1 routing-mark=ISP1 scope=30 target-scope=30
add gateway=2.2.2.2 routing-mark=ISP2 scope=30 target-scope=30
add distance=10 gateway=2.2.2.2 routing-mark=ISP1 scope=30 target-scope=30
add distance=10 gateway=1.1.1.1 routing-mark=ISP2 scope=30 target-scope=30

now, if both 213.180.204.3 (via 192.168.1.1) and 93.158.134.3 (via 192.168.2.1) are reachable, ‘ISP1’ routing table uses 192.168.1.1, ‘ISP2’ uses 192.168.2.1 as default gateway. if one of 213.180.204.3/93.158.134.3 stops responding to ping, all traffic is routed to another modem

comments are welcome =)

I’ll try in ten days, when I return to the office.

Thanks!!!

oops, I don’t exactly remember where I have got this fake addresses in my investigations, but actually they are not needed - it’s maybe just more beautiful (and easy-to-change) to use them ))) below is ‘lite’ version :smiley:

/ip route
add dst-address=213.180.204.3/32 gateway=192.168.1.1 scope=10 target-scope=10
add dst-address=93.158.134.3/32 gateway=192.168.2.1 scope=10 target-scope=10
add gateway=213.180.204.3 routing-mark=ISP1 scope=30 target-scope=30 check-gateway=ping
add gateway=93.158.134.3 routing-mark=ISP2 scope=30 target-scope=30 check-gateway=ping
add distance=10 gateway=93.158.134.3 routing-mark=ISP1 scope=30 target-scope=30 check-gateway=ping
add distance=10 gateway=213.180.204.3 routing-mark=ISP2 scope=30 target-scope=30 check-gateway=ping

Mmm. This is working fine with google and microsoft ips.. but:

My router is now making ping to google and microsoft.. 24x7.. what can they do if they look this extrange infinite ping?
We can make a script to change the IPs every 24 hours but I don’t know if it’s necessary.

How many pings make the check gateway option in a minute? it’s possible to set how many seconds between pings?

Thanks,

just relax - the best half of the world pings those servers twenty four hours a day, they won’t notice you =)

also, you may use some nearer sites: some of your ISP devices, for example…

aaaaaaaargh, I have to give you a Karma. Catching you will be very difficult.. xD

thanks, this works very well for 3 hours, we will try it all this week.