Syed Jahanzaib – Personal Blog to Share Knowledge !

July 27, 2011

Mikrotik DUAL WAN Load Balancing using PCC method ! by zaiB

Filed under: Mikrotik Related — Tags: , , , , — Syed Jahanzaib / Pinochio~:) @ 10:16 AM


Mikrotik  DUAL WAN Load Balancing using PCC method. Complete Script ! by zaiB

pcc

This post illustrates on how you can configure load balancing of multiple wan links using Mikrotik Routerboard hardware (or RouterOS x86 version).  In this example I have used Mikrotik Routerboard CCR 1036 model.  Don’t forget to rename the interface names accordingly if you are a copy paste fan

  • 2 ports were connected with two difference DSL Routers
  • and 3rd port was connected with User LAN.
  • Both DSL are of same speed , i.e 10 Mb each.

DSL MODEM IP’S

  • DSL MODEM 1 = 192.168.1.1
  • DSL MODEM 2 = 192.168.2.1

In this example, we are using PCC (per connection classifier) method to achieve the load balancing. There are few options using this approach & each option may give you different results.

Example#1:  src-address

  • Use src-address as classifier, this way you will get rid of problems like https/broken link, streaming issues etc (dueot ip changing on each request) . Load balancing using this PCCtechnique (src-address) requires that users must be hitting the PCC box directly (either dhcp/ppp server etc). In this method user will be tagged with specific WAN link once connected with the mikrotik. This way till his online session he will stick to that particular wan link. A single user will not be ale to use all WAN links. This approach works good if you have a bit higher amount of bandwidth on each link.

Example#2: both-addresses-and-ports

  • If somehow you are not satisfied with the src-address approach (OR your requirements is to achieve maximum download speed using all WAN links simultaneously) , Then play with the PCC Classifier, Try both addresses and ports as the classifier (as used in this guide as well). While this will randomize things the most and in theory give you the most fair allocation of bandwidth (as any request will be distributed among all WAN links), BUT there is also a good chance that it will break certain things like banking web sites and some forums. This is because often times a HTTP requests will generate several connections, so there is a chance that some requests may go out a different route than the initial one, and that will break secure web sites. For that reason I usually like to go with src-address PCC load balancing approach (but only if users are hitting the pcc box)

~Syed Jahanzaib


PCC Script !

All Done ! Now Test the link by putting user load, the more multiple users load you put on it, the better Load Balance result you will get 🙂


PCC WITH UN-EQUAL WAN LINKS

If you have Un-Equal WAN Links, for example WAN,1 is of 4MB and WAN,2 is of 8 Mb, and you want to force MT to use WAN2 link more then other because of its capacity, Then you have to Add more PCC rules assigning the same two marks to a specific link i.e WAN2 , something like

Code:


/ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1
add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.8.8
/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2
add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2
/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping
/ip firewall nat
add chain=srcnat out-interface=WAN1 action=masquerade
add chain=srcnat out-interface=WAN2 action=masquerade

 


PCC WITH HOTSPOT (Reference)

/ip firewall nat add action=accept chain=pre-hotspot disabled=no dst-address-type=!local hotspot=auth

 

٩(●̮̮̃•̃)۶   ZaiB   ٩(●̮̮̃•̃)۶

397 Comments »

  1. hi
    plz contact me…..
    and tell me where you live……
    am Shahzad form pakistan/multan
    my phone number # 0092312-6460823

    Liked by 1 person

    Comment by shahzad — July 31, 2011 @ 5:42 AM

    • You can contact me at my email address.
      aacable [at] hotmail.com / 0092333.xxxxxxx

      Liked by 1 person

      Comment by Pinochio / zaib — July 31, 2011 @ 6:05 AM

      • Dear, how can you make the router make load balancing on tow interfaces i will use one for my hotspote and the other for my internal LAN

        Like

        Comment by mtaherhassanin — December 27, 2012 @ 9:59 AM

      • Describe in details.

        Liked by 1 person

        Comment by Syed Jahanzaib / Pinochio~:) — December 27, 2012 @ 3:06 PM

      • I Have RB 750GL with 5 Ports i will use 3 Ports for WANs DSL Routers , the rest 2 Ports i will Use them 1 For my LAN and 1 For My HotSpot Bullet. i Used your Script from the Above as the followng

        /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=41.128.225.225,41.128.225.226,163.121.128.135
        /ip firewall mangle
        add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
        add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

        add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
        add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

        add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local——– This for my Lan
        add chain=prerouting dst-address=192.168.3.0/24 action=accept in-interface=Local

        add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local2———— this for my Hotspot
        add chain=prerouting dst-address=192.168.3.0/24 action=accept in-interface=Local2

        add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
        add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
        add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes

        add chain=prerouting dst-address-type=!local in-interface=Local2 per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
        add chain=prerouting dst-address-type=!local in-interface=Local2 per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
        add chain=prerouting dst-address-type=!local in-interface=Local2 per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes

        add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
        add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

        /ip route
        add dst-address=0.0.0.0/0 gateway=192.168.2.254 routing-mark=to_WAN1 check-gateway=ping
        add dst-address=0.0.0.0/0 gateway=192.168.3.254 routing-mark=to_WAN2 check-gateway=ping

        add dst-address=0.0.0.0/0 gateway=192.168.2.254 distance=1 check-gateway=ping
        add dst-address=0.0.0.0/0 gateway=192.168.3.254 distance=2 check-gateway=ping

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

        /ip firewall nat add action=accept chain=pre-hotspot disabled=no dst-address-type=!local hotspot=auth

        but i belive that my hot spot Not Acting well

        Like

        Comment by mtaherhassanin — December 30, 2012 @ 5:20 AM

      • Hello Dear
        Well i have a Question
        in RB 750 Mikrotik
        Local Interface Pluged To ISA Server
        Local2 Pluged To Hotspot System
        I am Behind the ISA Server
        how can i mange to make the PING to the Hotspot system succeded
        Local 192.168.88.0/24
        Local2 192.168.80.0/24

        Like

        Comment by mtaherhassanin — December 31, 2012 @ 10:29 AM

    • Dear sir can it possible on 3g modem? EVO PTCL

      Like

      Comment by Rana Aamir — July 20, 2012 @ 9:35 PM

    • Plz help me with a scrip for a b750

      3 adsl 4mb
      wan
      192.168.2.1 dns 196.7..7.7
      192.168.3.1
      192.168.4.1

      lan
      192.168.7.1

      hotspot
      192.168.8.1

      thanks
      ben

      Like

      Comment by Ben Heydenrych — June 29, 2013 @ 10:06 PM

  2. How can i achieve load balancing with these typr of setup.
    2 wan and 1 hotspot LAN.
    normal web/light browsing traffic should be directed to WAN1 while heavy and other traffic should go to WAN 2.

    Like

    Comment by Collins — August 1, 2011 @ 3:26 PM

    • You have to do policy base load balancing.
      or you can mark packets for specific traffic and route it to your desired WAN link.

      Like

      Comment by Pinochio / zaib — August 4, 2011 @ 6:03 AM

  3. i am also enabled proxy because WAN1 is billing me based on volume of data i use.

    Like

    Comment by Collins — August 1, 2011 @ 4:01 PM

  4. hello sir i am aman can you help me how mikrotik load balasing and modem setting what is your mobile no and your E-mail

    Like

    Comment by Aman Manifarooqi — August 1, 2011 @ 4:05 PM

  5. plz sir help me

    Like

    Comment by Aman Manifarooqi — August 1, 2011 @ 4:06 PM

  6. my name is Aman farooqi plz you help me from pakistan RAWAlpindi mikrotik load balascing how make and how modem settend

    Like

    Comment by Aman Manifarooqi — August 1, 2011 @ 4:11 PM

  7. / ip address
    add address=1.1.0.5/24 network=1.1.0.0 broadcast=1.1.0.255 interface=Local comment=”” disabled=no
    add address=10.0.0.10/24 network=10.0.0.0 broadcast=10.0.0.255 interface=wan1 comment=”” disabled=no
    add address=7.7.7.10/24 network=7.7.7.0 broadcast=7.7.7.255 interface=wan2 comment=”” disabled=no

    / ip firewall mangle
    add chain=prerouting in-interface=Local connection-state=new nth=2,1 action=mark-connection new-connection-mark=conn1 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=Local connection-mark=conn1 action=mark-routing new-routing-mark=conn1 passthrough=no comment=”” disabled=no
    add chain=prerouting in-interface=Local connection-state=new nth=1,1 action=mark-connection new-connection-mark=conn2 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=Local connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment=”” disabled=no

    / ip firewall nat
    add chain=srcnat connection-mark=conn1 action=masquerade out-interface=wan1 comment=”” disabled=no
    add chain=srcnat connection-mark=conn2 action=masquerade out-interface=wan2 comment=”” disabled=no

    / ip route
    add dst-address=0.0.0.0/0 gateway=10.0.0.138 scope=255 target-scope=10 routing-mark=conn1 comment=”” disabled=no
    add dst-address=0.0.0.0/0 gateway=7.7.7.7 scope=255 target-scope=10 routing-mark=conn2 comment=”” disabled=no

    Like

    Comment by Aman Manifarooqi — August 4, 2011 @ 11:21 PM

  8. ware is this problam khaa par masllha ho sakta hai kia modem ki setting bhi karni hai aghr karni hai to kia ya is main problam, hai

    Like

    Comment by Aman Manifarooqi — August 4, 2011 @ 11:25 PM

  9. / ip address
    add address=1.1.0.5/24 network=1.1.0.0 broadcast=1.1.0.255 interface=Local comment=”” disabled=no
    add address=1.1.0.77/24 network=1.1.0.0 broadcast=1.1.0.255 interface=wan1 comment=”” disabled=no
    add address=5.5.5.1/24 network=5.5.5.0 broadcast=5.5.5.255 interface=wan2 comment=”” disabled=no

    / ip firewall mangle
    add chain=prerouting in-interface=Local connection-state=new nth=2,1 action=mark-connection new-connection-mark=conn1 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=Local connection-mark=conn1 action=mark-routing new-routing-mark=conn1 passthrough=no comment=”” disabled=no
    add chain=prerouting in-interface=Local connection-state=new nth=1,1 action=mark-connection new-connection-mark=conn2 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=Local connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment=”” disabled=no

    / ip firewall nat
    add chain=srcnat connection-mark=conn1 action=masquerade out-interface=wan1 comment=”” disabled=no
    add chain=srcnat connection-mark=conn2 action=masquerade out-interface=wan2 comment=”” disabled=no

    / ip route
    add dst-address=0.0.0.0/0 gateway=1.1.0.5 scope=255 target-scope=10 routing-mark=conn1 comment=”” disabled=no
    add dst-address=0.0.0.0/0 gateway=5.5.5.1 scope=255 target-scope=10 routing-mark=conn2 comment=”” disabled=no

    Like

    Comment by Aman Manifarooqi — August 5, 2011 @ 6:57 PM

    • First turn off dhcp server seetings in modem than try…good luck

      Like

      Comment by Faisal — August 13, 2011 @ 10:31 PM

  10. ab yeh sahi kar bhi liya hai tab bhi net nahi chal rahaa hai plz help me ab kia karo yeh load balasing is liye kar rha hoo is se net ki 4mb aur 4mb ke speed 8 ati hai is liye plz ab dekhye kia karoblam hai

    Like

    Comment by Aman Manifarooqi — August 5, 2011 @ 6:59 PM

    • This is nth base load balancing which will give you some problems in steaming , https web sites etc. but try it anyways since its the simplest way to do load balance.

      Make some changes to your ip scheme.

      Change ‘Local’ interface ip to 10.0.0.1
      Change ‘WAN1’ ip to 192.168.1.1
      Change ‘WAN2’ ip to 192.168.2.1

      Change ‘WAN1’ DSL ROUTER LAN ip to 192.168.1.2
      Change ‘WAN2’ DSL ROUTER LAN ip to 192.168.2.2

      Now moving on to script.

      / ip address
      add address=10.0.0.1 network=10.0.0.0 broadcast=10.0.0.255 interface=Local comment=”” disabled=no
      add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=wan1 comment=”” disabled=no
      add address=192.168.2.1/24 network=192.168.2.0 broadcast=192.168.2.255 interface=wan2 comment=”” disabled=no

      / ip firewall mangle
      add chain=prerouting in-interface=Local connection-state=new nth=2,1 action=mark-connection new-connection-mark=conn1 passthrough=yes comment=”” disabled=no
      add chain=prerouting in-interface=Local connection-mark=conn1 action=mark-routing new-routing-mark=conn1 passthrough=no comment=”” disabled=no
      add chain=prerouting in-interface=Local connection-state=new nth=1,1 action=mark-connection new-connection-mark=conn2 passthrough=yes comment=”” disabled=no
      add chain=prerouting in-interface=Local connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment=”” disabled=no

      / ip firewall nat
      add chain=srcnat connection-mark=conn1 action=masquerade out-interface=wan1 comment=”” disabled=no
      add chain=srcnat connection-mark=conn2 action=masquerade out-interface=wan2 comment=”” disabled=no

      / ip route
      add dst-address=0.0.0.0/0 gateway=192.168.1.2 scope=255 target-scope=10 routing-mark=conn1 comment=”” disabled=no
      add dst-address=0.0.0.0/0 gateway=192.168.2.2 scope=255 target-scope=10 routing-mark=conn2 comment=”” disabled=no

      Like

      Comment by Pinochio / zaib — August 6, 2011 @ 6:32 AM

      • would you please give me Mikrotik DUAL WAN Load Balancing using PCC method in simple word i need 4WAN merging

        Like

        Comment by zain ul abdin — January 26, 2012 @ 4:16 PM

      • Can you be more specific what you meant by ‘Simple Words’
        The tutorial is complete reference guide. You can use it and modify it according to your need.

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — January 27, 2012 @ 11:23 AM

  11. thnaks you it is work

    Like

    Comment by Aman Manifarooqi — August 15, 2011 @ 11:06 PM

  12. plz sir help me how pcc load balasing 3.22

    Like

    Comment by Aman Manifarooqi — August 15, 2011 @ 11:08 PM

  13. I have implemented DUAL (2) WAN Load Balancing using PCC method and it is working fine without hotspot. But I want to implement this PCC method with hotspot service. Please let me know what I should do now.

    Like

    Comment by Kafi — August 22, 2011 @ 11:45 AM

    • Dear Kafi,

      I have never tested load balancing with HOTSPOT scenario, but what I have heard or read at forums, hotspot messes with load balancing method. But give it a try and share your experience with us.

      Like

      Comment by Pinochio / zaib — August 22, 2011 @ 11:51 AM

    • Yes this is very much possible achieving this kind of load balancing. Even RRD can get equal LB, but I will not recommend you to use RDD base algorithm as it have some issues with many sites n protocols. Use PCC instead.

      Just make sure that all users are hitting Mikrotik directly (where PCC is configured)

      The more users load you put on PCC, the better load balancing you will be able to get.

      Like

      Comment by Pinochio / zaib — August 24, 2011 @ 10:50 AM

    • Wow…. Amazing..
      How to do this with 2 WAN only?

      Like

      Comment by Danish Jamil — April 3, 2012 @ 1:52 PM

  14. bhai mai ny 2 pc mai mikrotik install kia hai 1 mai load balancing ki hai aur dosry mai user add hai aur per connetion classifier ko ma ny dst address pa set kia hai. kia yeh sahi hai yaha is sy b better ho akta hai…..
    dsl1
    dsl2———–mikrotik pcc (dst address)——–mikrotik pppoe server——-clients
    dsl3

    Like

    Comment by usmans — August 28, 2011 @ 1:01 AM

    • usman bhai mujay apna koi contect nuber dain plz mene loadbalsing ki kuch help lani hai app se

      Like

      Comment by sadaq — July 30, 2012 @ 8:38 AM

  15. dst-address works fine too. All depend on your usage scenario.
    You can configure pcc and pppoe on the same server. in this way you can use src-address as your classifier.

    Liked by 1 person

    Comment by Pinochio / zaib — August 28, 2011 @ 10:54 AM

  16. bhai agar mai pcc aur pppoe same sever mai configure karta ho to jab mai us mai thunder cache ka mangle rule add karta ho to wo work nai karta…is liy mai 2 server use kar raha ho….

    Like

    Comment by usmans — August 28, 2011 @ 2:07 PM

  17. Great to use PCC to load balance, but I don’t know I’m using nth is better at my network…

    Like

    Comment by another mikrotik tips — September 24, 2011 @ 9:30 AM

    • PCC is a very customizable and enhanced version of Load balancing as compared to NTH . Using PCC you can get rid of many problems found in NTH, for example, broken http/https link, streaming issues and some others. (Using pcc with src-address as classifier.)

      Anyhow if NTH is fulfilling your requirements and you are satisfied with the results, you can stick with it as loon as it doesn’t bother you 🙂

      Like

      Comment by Pinochio~:) — September 24, 2011 @ 10:30 AM

  18. im having one wan link- 4 Mb ,another one is 2Mb,
    is it is possible to loadbalance with pcc

    Like

    Comment by tamilmaran — October 28, 2011 @ 8:31 AM

    • yes you can,
      Just give create more pcc rule to give priority to 4mb rule, so 2mb will be used twice as compare to 2 mb, to get some balanced load balancing.

      Like

      Comment by Pinochio~:) — October 28, 2011 @ 12:33 PM

      • can u pls , edit n give me the script,
        im poor in scripting…

        Like

        Comment by tamilmaran — June 26, 2012 @ 12:02 AM

  19. Hi,
    I also have rb750. Now I want to do load balancing on 2 dsl lines. How will I know that port 1 is Local, port 2 is WAN1 ans so on?

    Also for WAN1 dsl is the ip address 192.168.1.1?
    And for WAN2 dsl is the ip address 192.168.2.1?

    Like

    Comment by Nouman Aziz — November 12, 2011 @ 4:59 PM

    • You can check port status by various ways.
      Following command will blink the port light.
      /interface ethernet blink ether1

      OR
      /interface ethernet monitor ether1
      /interface ethernet monitor ether2
      /interface ethernet monitor ether3

      Like

      Comment by Pinochio~:) — November 14, 2011 @ 10:38 AM

      • Sir

        I want to access winbox from wan port….please advice ,,,,,i have public static ip at my adsl router .i have add port forwading in router …port is 8291 : what i do at my 750GL router ….microtik router wan ip is 192.168.0.100 …and adsl router lan ip is 192.168.0.1…please advice …\

        Regards

        Like

        Comment by faisalmirzapk — April 10, 2013 @ 7:18 PM

  20. dear sir,

    i want to implement fcc method with pppoe server in 1mikrotik OS x86 pc…..

    how to do that?

    kindly help me ASAP……;)

    Like

    Comment by fareed — November 16, 2011 @ 9:14 AM

  21. i have 2 Satellite internet connections and i want to do loadbalancing and i have 2 diffrent public ips.

    Like

    Comment by fareed — November 16, 2011 @ 9:17 AM

  22. Thankx For Help ……………………

    Like

    Comment by Mazhar Sheikh — November 16, 2011 @ 3:28 PM

  23. 3 wan load balancing, no need to set static IP to the interfaces;

    multiple ADSL services and the Mikrotik PCC rules along with some inbound mangling to allow a single router to load balance traffic across as many non bonded links as required.

    credits to: http://www.mikrotik-routeros.com/?p=12

    Note that none of this config requires the use of IP addresses at all, as it simply uses the pppoe-client interfaces and your lan interface to mark traffic. In my example wan1-pppoe,wan2-pppoe,wan3-pppoe are used and lan

    /ip route
    add check-gateway=arp comment=”WAN 3  – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=wan3
    add check-gateway=arp comment=”WAN 2  – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=wan2
    add check-gateway=arp comment=”WAN 1  – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=wan1
    add check-gateway=arp comment=”WAN 1  – Distance 2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=wan1
    add check-gateway=arp comment=”WAN 2  – Distance 2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=wan2
    add check-gateway=arp comment=”WAN 3  – Distance 2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=wan3
    add check-gateway=arp comment=”WAN 1  – Distance 3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=wan1
    add check-gateway=arp comment=”WAN 2  – Distance 3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=wan2
    add check-gateway=arp comment=”WAN 3  – Distance 3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=wan3
    add check-gateway=arp comment=”Default Route – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1-pppoe
    add check-gateway=arp comment=”Default Route – Distance 2″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe
    add check-gateway=arp comment=”Default Route – Distance 3″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2-pppoe
    add check-gateway=arp comment=”Static Route – WAN1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=static-wan1
    add check-gateway=arp comment=”Static Route – WAN2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=static-wan2
    add check-gateway=arp comment=”Static Route – WAN3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=static-wan3

    /ip firewall mangle
    add action=mark-connection chain=input comment=”Mark new inbound connection wan1″ connection-state=new disabled=no in-interface=wan1-pppoe new-connection-mark=wan1 \
    passthrough=yes
    add action=mark-connection chain=input comment=”Mark new inbound connection wan2″ connection-state=new disabled=no in-interface=wan2-pppoe new-connection-mark=wan2 \
    passthrough=yes
    add action=mark-connection chain=input comment=”Mark new inbound connection wan3″ connection-state=new disabled=no in-interface=wan3-pppoe new-connection-mark=wan3 \
    passthrough=yes
    add action=mark-connection chain=prerouting comment=”Mark established inbound connection wan1″ connection-state=established disabled=no in-interface=wan1-pppoe \
    new-connection-mark=wan1 passthrough=yes
    add action=mark-connection chain=prerouting comment=”Mark established inbound connection wan2″ connection-state=established disabled=no in-interface=wan2-pppoe \
    new-connection-mark=wan2 passthrough=yes
    add action=mark-connection chain=prerouting comment=”Mark established inbound connection wan3″ connection-state=established disabled=no in-interface=wan3-pppoe \
    new-connection-mark=wan3 passthrough=yes
    add action=mark-connection chain=prerouting comment=”Mark related inbound connection wan1″ connection-state=related disabled=no in-interface=wan1-pppoe \
    new-connection-mark=wan1 passthrough=yes
    add action=mark-connection chain=prerouting comment=”Mark related inbound connection wan2″ connection-state=related disabled=no in-interface=wan2-pppoe \
    new-connection-mark=wan2 passthrough=yes
    add action=mark-connection chain=prerouting comment=”Mark related inbound connection wan3″ connection-state=related disabled=no in-interface=wan3-pppoe \
    new-connection-mark=wan3 passthrough=yes
    add action=mark-routing chain=output comment=”Mark new inbound route wan1″ connection-mark=wan1 disabled=no new-routing-mark=static-wan1 passthrough=no
    add action=mark-routing chain=output comment=”Mark new inbound route wan2″ connection-mark=wan2 disabled=no new-routing-mark=static-wan2 passthrough=no
    add action=mark-routing chain=output comment=”Mark new inbound route wan3″ connection-mark=wan3 disabled=no new-routing-mark=static-wan3 passthrough=no
    add action=mark-connection chain=prerouting comment=”Mark traffic that isn’t local with PCC mark rand (3 possibilities) – option 1″ connection-state=new disabled=no \
    dst-address-type=!local in-interface=lan new-connection-mark=wan1_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/0
    add action=mark-connection chain=prerouting comment=”Mark traffic that isn’t local with PCC mark rand (3 possibilities) – option 2″ connection-state=new disabled=no \
    dst-address-type=!local in-interface=lan new-connection-mark=wan2_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/1
    add action=mark-connection chain=prerouting comment=”Mark traffic that isn’t local with PCC mark rand (3 possibilities) – option 3″ connection-state=new disabled=no \
    dst-address-type=!local in-interface=lan new-connection-mark=wan3_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/2
    add action=mark-connection chain=prerouting comment=”Mark established traffic that isn’t local with PCC mark rand (3 possibilities) – option 1″ connection-state=\
    established disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan1_pcc_conn passthrough=yes per-connection-classifier=\
    both-addresses:3/0
    add action=mark-connection chain=prerouting comment=”Mark established traffic that isn’t local with PCC mark rand (3 possibilities) – option 2″ connection-state=\
    established disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan2_pcc_conn passthrough=yes per-connection-classifier=\
    both-addresses:3/1
    add action=mark-connection chain=prerouting comment=”Mark established traffic that isn’t local with PCC mark rand (3 possibilities) – option 3″ connection-state=\
    established disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan3_pcc_conn passthrough=yes per-connection-classifier=\
    both-addresses:3/2
    add action=mark-connection chain=prerouting comment=”Mark related traffic that isn’t local with PCC mark rand (3 possibilities) – option 1″ connection-state=related \
    disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan1_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/0
    add action=mark-connection chain=prerouting comment=”Mark related traffic that isn’t local with PCC mark rand (3 possibilities) – option 2″ connection-state=related \
    disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan2_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/1
    add action=mark-connection chain=prerouting comment=”Mark related traffic that isn’t local with PCC mark rand (3 possibilities) – option 3″ connection-state=related \
    disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan3_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/2
    add action=mark-routing chain=prerouting comment=”Mark routing for  PCC mark – option 1″ connection-mark=wan1_pcc_conn disabled=no new-routing-mark=wan1 passthrough=\
    yes
    add action=mark-routing chain=prerouting comment=”Mark routing for  PCC mark – option 2″ connection-mark=wan2_pcc_conn disabled=no new-routing-mark=wan2 passthrough=\
    yes
    add action=mark-routing chain=prerouting comment=”Mark routing for  PCC mark – option 3″ connection-mark=wan3_pcc_conn disabled=no new-routing-mark=wan3 passthrough=\
    yes

    Like

    Comment by adrian — November 26, 2011 @ 7:25 AM

    • Hi, what about NAT rules ? (script in IP-Firewall-NAT)

      Like

      Comment by esalehnet — November 29, 2012 @ 1:30 AM

    • Is this line typo?
      add check-gateway=arp comment=”Default Route – Distance 2″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe

      Like

      Comment by maximusmx — October 1, 2021 @ 1:48 PM

  24. is is working OK to me, after I modified a bit to use only 2 wans on my router

    Like

    Comment by adrian — November 26, 2011 @ 7:29 AM

  25. Jahanzaib Bhai I need your help Would you…………….

    Like

    Comment by Umair Hanif — December 4, 2011 @ 8:28 PM

    • Regarding ???

      Like

      Comment by Pinochio~:) — December 7, 2011 @ 10:42 AM

      • i have mikrotik 3.22 and i want to use 2 WAN link load balancing

        Like

        Comment by umair — December 13, 2011 @ 11:03 PM

      • You need at least ver 3.30 for pcc base load balancing.

        Like

        Comment by Pinochio~:) — December 14, 2011 @ 10:42 AM

  26. I have upgraded to version 3.30

    Like

    Comment by umair — December 14, 2011 @ 11:46 PM

  27. These are great scripts, but could you possibly explain how to change the gateway check to check a remote IP address rather than the gateway IP address (for instances where the DSL line may be down, but the modem still up) – im sure its not as easy as just changing the ip address in the check?

    Like

    Comment by David — December 22, 2011 @ 4:26 PM

    • You are right, its not that easy to integrate netwatch with the PCC.
      I stopped working on this script long time ago. I will do some r&d on it and will update the article accordingly.

      Like

      Comment by Pinochio~:) — December 23, 2011 @ 10:59 AM

    • Salam Dear Sir ,

      Sir ap kasy hai .umied hai k ap thek hai .ALLAH ap per desta shufqat rakha.Sir main UBNT wireless setup laga raha hun.Aur sir mujha ap say kuch help ke zaroorat hai .wo ya k main us k liya mikrotik ka kon sa ver use karun uar mikrotik ruterbord kon sa purchas karun.qk es ma humara pass dedicated links be hai .aur SIR humara owner ya chata hai k ptcl jasie wireless modem ma setting ho.
      SIR Cache server be creat karna hai kindly ap us ka be bta dijya ga. Sir main umied karta hun k ap jaldi aur bhater jawab send kary gia.

      Waqas sabir from Faisalabad.
      E-mail = the2ndlastguy@yahoo.com
      Mob= 03157215729

      Like

      Comment by Muhammad Waqas Sabir — August 30, 2012 @ 10:54 PM

  28. Hi,
    Sir I have done dual wan load balancing on MK RB750 v 5.9. I have two 4 mbps connection.

    The problem I am facing is the second dsl line is not much is use. Sometimes I get 7-8 mB speed but sometimes it drops out so I just left with the 4MB.

    Any thoughts or suggestions?

    Thanks.

    Like

    Comment by Nouman Aziz — December 23, 2011 @ 1:05 AM

    • If ‘sometimes’ you able to get 7-8 mbps , then your PCC is configure okay.
      what classifier are you using?

      Like

      Comment by Pinochio~:) — December 23, 2011 @ 10:57 AM

  29. I am using Dst.Address for both lines.

    Like

    Comment by Nouman Aziz — December 25, 2011 @ 12:10 AM

    • It will happen if you use dst-address, for example if there are 10 online users and 8 of them are using you tube.com, then PCC will bind you-tube at first dsl link, and other web at other link.

      You have to read a lot on PCC classifier, goto wiki and read thoroughly then play with this option.

      Like

      Comment by Pinochio~:) — December 25, 2011 @ 9:44 AM

  30. So which classifier should I use?

    Like

    Comment by Nouman Aziz — December 25, 2011 @ 10:09 AM

  31. Can you please explain me which classifier do I change and how?

    Thanks.

    Like

    Comment by Nouman Aziz — December 25, 2011 @ 12:43 PM

    • Dear Noman,

      I guess its time for you to do some research and read teh mikrotik wiki on How PCC works. Please start with this one and you will get idea on which classifier is best for you.
      http://wiki.mikrotik.com/wiki/How_PCC_works_(beginner)

      After all its your network and you have to decide what classifer to use depends on your network usage. Please Read, Read and Read.

      Like

      Comment by Pinochio~:) — December 25, 2011 @ 10:17 PM

  32. ok Thanks/.

    Like

    Comment by Nouman — December 26, 2011 @ 1:04 AM

  33. sir muhe yee bataye ke x86 main bhi pcc load balasing ho sakti hai

    Like

    Comment by noman — December 31, 2011 @ 7:20 PM

    • It doesn’t matter what architecture you use , you can do it on x86 or any RB.
      Just make sure you use ver 3.30 or above.
      preferably latest 5.x series.

      Like

      Comment by Pinochio~:) — December 31, 2011 @ 9:17 PM

  34. Sir, This load balancing works great when we put a load on it (browse heavy site, or watch youtube). Is there any way to keep both WAN’s alive and working equally.
    For example even when we browse lite sites it should use both lines 50/50.

    Thanks

    Like

    Comment by nominet — January 4, 2012 @ 3:45 PM

  35. I have tried them and I liked ‘scr-address’ and ‘both-addresses and ports’ one.

    Like

    Comment by Nouman — January 5, 2012 @ 12:26 AM

  36. Sir what is failover?

    Like

    Comment by Ayoob — January 6, 2012 @ 1:30 AM

    • ‘Failover’ It will always check the modem status before sending any packets, If the modem is not reachable it will not send the packets.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 6, 2012 @ 10:55 AM

  37. I want to add another WAN3 with the ip 192.168.3.1

    Can you please write a script for me thanks.

    Like

    Comment by Asad — January 6, 2012 @ 11:27 AM

    • /ip route
      add check-gateway=arp comment=”WAN 3 – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=wan3
      add check-gateway=arp comment=”WAN 2 – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=wan2
      add check-gateway=arp comment=”WAN 1 – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=wan1
      add check-gateway=arp comment=”WAN 1 – Distance 2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=wan1
      add check-gateway=arp comment=”WAN 2 – Distance 2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=wan2
      add check-gateway=arp comment=”WAN 3 – Distance 2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=wan3
      add check-gateway=arp comment=”WAN 1 – Distance 3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=wan1
      add check-gateway=arp comment=”WAN 2 – Distance 3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=wan2
      add check-gateway=arp comment=”WAN 3 – Distance 3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=wan3
      add check-gateway=arp comment=”Default Route – Distance 1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1-pppoe
      add check-gateway=arp comment=”Default Route – Distance 2″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe
      add check-gateway=arp comment=”Default Route – Distance 3″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2-pppoe
      add check-gateway=arp comment=”Static Route – WAN1″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1-pppoe routing-mark=static-wan1
      add check-gateway=arp comment=”Static Route – WAN2″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2-pppoe routing-mark=static-wan2
      add check-gateway=arp comment=”Static Route – WAN3″ disabled=no distance=3 dst-address=0.0.0.0/0 gateway=wan3-pppoe routing-mark=static-wan3
      /ip firewall mangle
      add action=mark-connection chain=input comment=”Mark new inbound connection wan1″ connection-state=new disabled=no in-interface=wan1-pppoe new-connection-mark=wan1 \
      passthrough=yes
      add action=mark-connection chain=input comment=”Mark new inbound connection wan2″ connection-state=new disabled=no in-interface=wan2-pppoe new-connection-mark=wan2 \
      passthrough=yes
      add action=mark-connection chain=input comment=”Mark new inbound connection wan3″ connection-state=new disabled=no in-interface=wan3-pppoe new-connection-mark=wan3 \
      passthrough=yes
      add action=mark-connection chain=prerouting comment=”Mark established inbound connection wan1″ connection-state=established disabled=no in-interface=wan1-pppoe \
      new-connection-mark=wan1 passthrough=yes
      add action=mark-connection chain=prerouting comment=”Mark established inbound connection wan2″ connection-state=established disabled=no in-interface=wan2-pppoe \
      new-connection-mark=wan2 passthrough=yes
      add action=mark-connection chain=prerouting comment=”Mark established inbound connection wan3″ connection-state=established disabled=no in-interface=wan3-pppoe \
      new-connection-mark=wan3 passthrough=yes
      add action=mark-connection chain=prerouting comment=”Mark related inbound connection wan1″ connection-state=related disabled=no in-interface=wan1-pppoe \
      new-connection-mark=wan1 passthrough=yes
      add action=mark-connection chain=prerouting comment=”Mark related inbound connection wan2″ connection-state=related disabled=no in-interface=wan2-pppoe \
      new-connection-mark=wan2 passthrough=yes
      add action=mark-connection chain=prerouting comment=”Mark related inbound connection wan3″ connection-state=related disabled=no in-interface=wan3-pppoe \
      new-connection-mark=wan3 passthrough=yes
      add action=mark-routing chain=output comment=”Mark new inbound route wan1″ connection-mark=wan1 disabled=no new-routing-mark=static-wan1 passthrough=no
      add action=mark-routing chain=output comment=”Mark new inbound route wan2″ connection-mark=wan2 disabled=no new-routing-mark=static-wan2 passthrough=no
      add action=mark-routing chain=output comment=”Mark new inbound route wan3″ connection-mark=wan3 disabled=no new-routing-mark=static-wan3 passthrough=no
      add action=mark-connection chain=prerouting comment=”Mark traffic that isn’t local with PCC mark rand (3 possibilities) – option 1″ connection-state=new disabled=no \
      dst-address-type=!local in-interface=lan new-connection-mark=wan1_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/0
      add action=mark-connection chain=prerouting comment=”Mark traffic that isn’t local with PCC mark rand (3 possibilities) – option 2″ connection-state=new disabled=no \
      dst-address-type=!local in-interface=lan new-connection-mark=wan2_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/1
      add action=mark-connection chain=prerouting comment=”Mark traffic that isn’t local with PCC mark rand (3 possibilities) – option 3″ connection-state=new disabled=no \
      dst-address-type=!local in-interface=lan new-connection-mark=wan3_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/2
      add action=mark-connection chain=prerouting comment=”Mark established traffic that isn’t local with PCC mark rand (3 possibilities) – option 1″ connection-state=\
      established disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan1_pcc_conn passthrough=yes per-connection-classifier=\
      both-addresses:3/0
      add action=mark-connection chain=prerouting comment=”Mark established traffic that isn’t local with PCC mark rand (3 possibilities) – option 2″ connection-state=\
      established disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan2_pcc_conn passthrough=yes per-connection-classifier=\
      both-addresses:3/1
      add action=mark-connection chain=prerouting comment=”Mark established traffic that isn’t local with PCC mark rand (3 possibilities) – option 3″ connection-state=\
      established disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan3_pcc_conn passthrough=yes per-connection-classifier=\
      both-addresses:3/2
      add action=mark-connection chain=prerouting comment=”Mark related traffic that isn’t local with PCC mark rand (3 possibilities) – option 1″ connection-state=related \
      disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan1_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/0
      add action=mark-connection chain=prerouting comment=”Mark related traffic that isn’t local with PCC mark rand (3 possibilities) – option 2″ connection-state=related \
      disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan2_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/1
      add action=mark-connection chain=prerouting comment=”Mark related traffic that isn’t local with PCC mark rand (3 possibilities) – option 3″ connection-state=related \
      disabled=no dst-address-type=!local in-interface=lan new-connection-mark=wan3_pcc_conn passthrough=yes per-connection-classifier=both-addresses:3/2
      add action=mark-routing chain=prerouting comment=”Mark routing for PCC mark – option 1″ connection-mark=wan1_pcc_conn disabled=no new-routing-mark=wan1 passthrough=\
      yes
      add action=mark-routing chain=prerouting comment=”Mark routing for PCC mark – option 2″ connection-mark=wan2_pcc_conn disabled=no new-routing-mark=wan2 passthrough=\
      yes
      add action=mark-routing chain=prerouting comment=”Mark routing for PCC mark – option 3″ connection-mark=wan3_pcc_conn disabled=no new-routing-mark=wan3 passthrough=\
      yes

      after that all you need to do is make your 3 pppoe client conections coresponding to your wans, pppoe client cone3ctions with user and pass provided from yout ISP, and in NAT…make a masquerade in ip firewall nat… click + to add net nat rule, Chain – scrnat….than go to Action tab and select masquerade… that is all

      this config is the config that I am using on a rb750, for 3 wans

      Like

      Comment by Acidu — January 6, 2012 @ 6:40 PM

  38. Hi Sir,
    What is the function of distance in routes?

    Like

    Comment by Asad — January 6, 2012 @ 8:34 PM

  39. Hi, thanks for the great howto. I have a setup with 2 WANs and when I vpn to the router I can no longer ping or connect to the local addresses.
    Local interface is: 192.168.0.0/24
    VPN local address is: 10.0.1.100
    VPN remote address is: 10.0.2.100
    Before setting up the load balancing I was able to connect to 192.168.0.102 or 192.168.0.101.

    Like

    Comment by quinametin — January 18, 2012 @ 10:05 AM

  40. Which classifier should I use? I want 4 + 4 = 8. So traffic should spread aross them two links.

    Thanks.

    Like

    Comment by Bablu — January 18, 2012 @ 1:54 PM

  41. Jitna b Geo Khushi se Geo. Ye Bablu ki dua ha Jahanzaib Bhai.

    Like

    Comment by Bablu — January 19, 2012 @ 3:29 PM

  42. Hello,
    Thank you for helpful posts,
    I little bit confused with IP addresses and how to setup load balance with my RB750G.
    I have 2 ADSL from same ISP with 2 linksys modems with static external IP and 10M speed each.I cannot access the modems they r locked by ISP. I just getting internal IP by DHCP in range 192.168.1.1/254.
    On both modems are same gateway address 192.168.1.1 and same IP range.
    How can I configure load balancing????
    Please help!!!! Need ASAP!!!
    Thank you in advance!!!

    Nikos

    Like

    Comment by Nikos — January 25, 2012 @ 2:11 AM

    • Move them on different subnet.
      For example

      ISP DSL Modems:
      DSL1 = 192.168.1.1
      DSL2 = 192.168.2.1

      Mikrotik:
      WAN1 = 192.168.1.2 / GW > 192.168.1.1
      WAN2 = 192.168.2.2 / GW > 192.168.2.1

      This way things will get simpler and manageable for you.
      You can use static ip on you mikrotik wan interface of same subnet series provided by the modem.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 25, 2012 @ 10:56 AM

      • Thank you for fast response,
        The problem is that I cannot change DSL2 to 192.168.2.1 its locked by ISP and both DSL modems had same 192.168.1.1.
        In my scenario it will be something like this :
        DSL1:192.168.1.1==>WAN1=192.168.1.2
        DSL2:192.168.1.1==>WAN2=192.168.1.3
        This will work or NOT???
        Please advice !!!
        Thank you in advance
        Nikos

        Like

        Comment by Nikos — January 25, 2012 @ 7:12 PM

      • I have not tested such scenario, in my opinion it should not work.

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — January 26, 2012 @ 10:55 AM

    • !Try defining the outbound interface.
      For example replace this.
      /ip route
      add dst-address=0.0.0.0/0 gateway=1.2.3.4 routing-mark=to_wan-ISP1 check-gateway=ping
      add dst-address=0.0.0.0/0 gateway=1.2.3.4 routing-mark=to_wan-ISP2 check-gateway=ping

      With following

      /ip route
      add dst-address=0.0.0.0/0 gateway=1.2.3.4%eth1-ISP routing-mark=to_wan-ISP1 check-gateway=ping
      add dst-address=0.0.0.0/0 gateway=1.2.3.4%eth2-ISP routing-mark=to_wan-ISP2 check-gateway=ping

      Replace the eth1-ISP with your own wan itnerface name , use the notation % for sure.
      If it works , let me know

      Regard’s

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — October 21, 2013 @ 11:59 AM

  43. Alsalamu Alaykom

    Dear Brother can you please send me a Backup file for RB 750 Load Balance ?

    Like

    Comment by Moataz Ibrahem — January 30, 2012 @ 11:02 PM

  44. sir main ne pcc load balasing ki hai load balasing to sahi hai par dhcp par webproxy nahi chal rahey plz help me

    Like

    Comment by mani — January 31, 2012 @ 12:05 AM

    • If you upgrade to 4.x that’s relatively easy to do because it has a feature that can match connections that do not yet have a connection mark.

      I will not recommend you to use mikrotik webproxy with pcc on same box, It is recommended to use external proxy like SQUID or ISA. Upgrade to new version and it will be easy for you to use mikrotik web proxy.

      /ip firewall mangle
      add chain=output connection-mark=no-mark action=mark-connection new-connection-mark=Internet1_conn passthrough=yes per-connection-classifier=both-addresses:2/0
      add chain=output connection-mark=no-mark action=mark-connection new-connection-mark=Internet2_conn passthrough=yes per-connection-classifier=both-addresses:2/1

      On 3.x the rule set would be quite much more complicated to make sure you don’t interfere with potentially existing connection marks that must not be changed, so hopefully you can upgrade to 4.x

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 31, 2012 @ 2:31 PM

  45. sir this script not work as failover it works only when modem turned off
    in the case when modem power is on but the modem is disconnect failover not work 100% sure
    sir i want a solution for failover free or paid not matter but perfect solution
    my id is zohaib.shakeel1@yahoo.com

    Like

    Comment by salman — January 31, 2012 @ 10:45 PM

  46. Aslam O Alikum Syed Jahanzaib Bahi

    My DSL 4MB PTCL

    I m Use Hotspot Par User 1MB Speed And 512k My Thinking Is a User End Download Speed Is Limited

    But Browsing Full 4MB Speed Please Add This Script And Send Me

    My ID waseemahmed147@yahoo.com

    I m use 3.22 v

    Thank You

    Like

    Comment by WASEEM AHMED — February 1, 2012 @ 5:12 AM

  47. hi
    i have 16 mb pipe connected with 4 wan tplink load balancer , and load balancer connect with mikro tik OS installed on pc i configured dns, firewall, web proxy correctly but my browsing speed is too slow. is in mikrotik there is place to mention wan link rate, means does mikro tik required the link rate in Wan link. if yes then plzz tell me becoz i m watching all time my wan link in interface option it never rich to 16 mb infect it is not crossing 4 mb in all time pick time non pick time …guide me as soon as possible………… thxzzzzzzzzzzzzz

    Like

    Comment by rehmat ali gulwating — February 7, 2012 @ 3:50 AM

    • Slow browsing , hmmm… there can be multiple issue, I told you earlier, make sure all of your client is using your mikrotik as there primary DNS server,
      secondly, using IDM , try to download 10-15 multiple files (Big downloads) and see if you can able to download from all links.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 7, 2012 @ 9:34 AM

  48. DEAR…….
    YES I CAN USE 16 MB PIPE WITH IDM BUT 1 TROUBLE I FIND THAT WHEN I PING TO TPLINK IP 192.168.205.1 REPLY IN 1 OR 2 MS CONTINUE SLY BUT WHEN I PING PTCL MODEM LAN IP (192.168.201.1 MODEM 1,192.168.202.1 MODEM 2, 192.168.203.1 MODEM 3,192.168.204.1 MODEM 4) SOME TIME PING REPLY IN 6 TO 7 MS AND SOME TIMES REQUEST TIME OUT OCCURS I CHANGE LAN CARDS OF MIKROTIK BUT NOTHING HAPPENED AND WHEN I CONNECT TPLINK LOADBALANCER DIRECT 2 WINDOWS PC PING REPLIES IN 1 MS AND ALL WORKED FINE…. THEN Y PING IS BREAKING WITH MIKROTIK PLEASE GUIDE ME AND SHOOT THIS TROUBLE WITH UR GOOD EXPERIENCE THANKING YOU,

    Like

    Comment by rehmat ali gulwating — February 10, 2012 @ 3:15 AM

  49. my name habib

    Like

    Comment by a — February 10, 2012 @ 9:27 PM

  50. are you on line in wordpress

    Like

    Comment by a — February 10, 2012 @ 9:28 PM

  51. Hi,
    Work fine, but “both-addresses-and-ports” per connection classifier creates problems (eg ftp client: passive ports are open on another WAN, so the ftp server considers it as a security violation). I recommend an “both addresses” pcc configuration to avoid this.

    Best regards

    Like

    Comment by Alexandre Alouit — February 13, 2012 @ 10:33 PM

    • Yes you are right, both address provides more reliable connections. But for some operators who demands more bandwidth rather then reliability, both-addresses-and-ports gives overall better load balancing, but they face broken link issues.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 14, 2012 @ 8:48 AM

  52. Salam,
    this is rehmat, i trace problem in my network it is from client side. i means my clients have a lots of viruses, Trojans and spammers and their pcs use tcp and udp ports to access wan.ports are 445,80,23 which i trace out i have problem with port 80 becoz its a browsing port (http) please send me rules or any script to block viruses,Trojans and spammers completely. or any other guide to resolve this issue. thxxxxxxxxxxx

    Like

    Comment by rehmat ali gulwating — February 14, 2012 @ 2:51 AM

  53. Hi. Salam jahanzaib bhai. jahanzaib bhai i have 4 mb connection of PTCL. and main mikrotik 3.30 pay hotspot server use kr raha hun. i have 30 clients on it . 300 gb limit ki waja say now i want to add one more 4 mb connection. Plz guide me k main kesay on ki load balancing krun. is wqt meray WAN ka address 192.168.1.150 and LAN ka address 192.168.0.150 hai. yaa to ap yay guide kr dain k dono 4 mb ka 50/50 use ho ya phr ya bta dain k main half clients WAN1 pay kesay krun and half WAN2 pay ? because main downloading limit ko cross nhi krna chahta. its too expensive for me if downloading limit crossed.

    Like

    Comment by SHAFQAT FARHAN — February 22, 2012 @ 10:45 AM

  54. and dono connections ptcl say liyay hain main nay so . dono ka ip address same hai yani k DSL1 192.168.1.1 and DSL2 192.168.1.1 and i dont have authority to change this address.

    Like

    Comment by SHAFQAT FARHAN — February 22, 2012 @ 10:51 AM

    • First thing first.
      Both links must be on different subnet, otherwise you won’t be able to do proper load balance.
      One workaround is to put another router (any cheap brand like tplink etc) in between mikrotik WAN2 and DSL2 and give it another subnet ip.
      For example like this.

      DSL1 ======> === >> MIKROTIK ROUTER ETH1
      192.168.1.1 192.168.1.2

      DSL2 ======> TPLINK ROUTER === >> MIKROTIK ROUTER ETH2
      192.168.1.1 192.168.5.1 192.168.5.2

      Also check this It might help you.

      MIKROTIK Policy Routing based on Client IP Address

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 23, 2012 @ 9:16 AM

  55. thank you so much sir. now i will change the ip address of one of the DSL router. now plz tell me how could i do load balancing on hotspot server. and i want k dono DSL’s equally use hun. i mean agar total downloading (from clients) 200 GB howi hai to DSL1 say 100 GB and DSL2 say 100 GB ho. i mean i want the average download from both of the DSL.

    Like

    Comment by SHAFQAT FARHAN — February 23, 2012 @ 11:51 AM

  56. to phr kya is trah ho skta hai k main half clients WAN1 pay kr dun and half WAN2 pay. ??

    Like

    Comment by SHAFQAT FARHAN — February 23, 2012 @ 12:06 PM

    • Yes you can, see the link i have sent earlier. policy/ip base client routing

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 23, 2012 @ 1:37 PM

      • jahanzaib bhai os policy main 2 LAN output hain. jab k meray pass situation kuch yun hai k meray pas bulletm2 hai. main wireless k through clients ko net provide kr raha hun. so agar main 2 output krta hun to bullet main to aik he input jaey gi.

        Like

        Comment by SHAFQAT FARHAN — February 23, 2012 @ 8:26 PM

      • You can use single output (LAN) also.
        The example showed in the article was not using 2 output, Both users are on same LAN.

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — February 24, 2012 @ 9:28 AM

  57. sir, give me a script of queue tree bandwith setting mikrotik rb750G please….. note: I use dual wan about it wan

    Like

    Comment by aanet — February 24, 2012 @ 7:22 AM

  58. dear sir
    Syed Jahanzaib
    sir main ne TWO wan ore ONE lan ka mikrotik server

    banya hai jis ka scrpit ye hai.

    ((
    /ip address
    add address=192.168.5.1/24 network=192.168.5.0 broadcast=192.168.5.255 interface=LAN
    add address=192.168.0.2/24 network=192.168.0.0 broadcast=192.168.0.255 interface=WAN1
    add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=208.67.220.220,208.67.222.222

    /ip firewall mangle
    add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

    add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

    add chain=prerouting dst-address=192.168.0.0/24 action=accept in-interface=LAN
    add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=LAN

    add chain=prerouting dst-address-type=!LAN in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!LAN in-interface=LAN per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    add chain=prerouting connection-mark=WAN1_conn in-interface=LAN action=mark-routing new-routing-mark=to_WAN1
    add chain=prerouting connection-mark=WAN2_conn in-interface=LAN action=mark-routing new-routing-mark=to_WAN2

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.0.1 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

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

    sir jab main internet

    use karta hun tu mera server srif os wan ka interinet

    use karta hai jis ki speed kam hoti hai jab k meri dosri

    wan per speed kafi achi hoti hai
    ek wan meri 3mbps ki hai ore dosri 4 mbps ki hai

    kindly tell me a script jis se main in dono wan ko use

    kar sekon yan phier asa ho in dono wan main se jis ki

    speed zaida ho server os wan ko use karey kindly send

    me a script jis se mera masla hal ho jaye

    Like

    Comment by ali — February 24, 2012 @ 9:50 PM

  59. jahanzaib bhai do u have some info that how can i get license of ISP from PTCL or PTA . and how much cost it have ??

    Like

    Comment by SHAFQAT FARHAN — February 25, 2012 @ 9:54 PM

  60. hi.. i’m using this script right now and i want to port forward (23156) from WAN1 to internet.. can u help me sir

    Like

    Comment by nick — March 5, 2012 @ 8:58 PM

  61. sir meine aap ka dual wan configuration wala script use kia hai leikin mere aik wan se reply nahin aaraha

    Like

    Comment by Yasir — March 9, 2012 @ 9:04 PM

  62. mein mikrotik ka os ver 3.3 use kerraha hoon

    Like

    Comment by Yasir — March 9, 2012 @ 9:09 PM

  63. hello !
    the difference with this scenario is that i have
    modem 1 IP : 79.106.15.44 ( bridge with PPPoE connection with username and password) or it doesn’t influence in the configuration
    modem 2 IP : 79.106.15.45 ( bridge with PPPoE connection with username and password)
    with gateway 79.106.14.1 or dynamic
    LAN : 192.168.2.1/24

    can you please help me with the configuration
    regards

    Like

    Comment by sidio — March 12, 2012 @ 3:52 AM

  64. salaam sir how are u
    main pppoe server use kar rahaa hooo aap mjhe yeh batao ke dil up par kon se colore use hote hai main ne net ki waire se bjiliy gozarni hai plz tell me

    Like

    Comment by musa — March 19, 2012 @ 9:57 AM

  65. hi,
    this is Rehmat ali have to ask one thing is that i follow script given by u on this page ( https://aacable.wordpress.com/2011/07/27/mikrotik-dual-wan-load-balancing-using-pcc-method-complete-script-by-zaib/ ) .

    problem is

    only 1 wan is using internet named wan1 but 2nd wan named wan4 is not using similarly means with pcc method i m able to use both links in same time……? if yes then please solve this issue because it can’t use both links in same time.
    Wan1 route is shows as AS and in black color but Wan4 route is shows as S and in blue color.

    i think problem is with ip route. reply me as soon as possible.
    thanking you,

    Like

    Comment by Rehmat Ali Gulwating — March 20, 2012 @ 3:34 PM

  66. Very Very Thanks Mr,Zaib With this script you changed my life

    Like

    Comment by Haroon nimroozy — March 29, 2012 @ 11:17 AM

  67. Dear Bro, I m using MIKROTIK from last 2 years with these settings.

    I have 4 WANS and 1 LAN. 1 wan 4Mbs, 2nd 4Mb, 3rd 6Mb and 4th is 2Mb. i splice the ip with differnet subnets and send traffic through routes. 1 group ips gets 4 2nd group ip also 4 3rd group 6 mb and 4th group 2mb. and all users or on PPPOE.

    But now i want to combine all traffic and then send it to 1 LAN. means 4 lans = 1 lan ,4+4+6+2=16 Mb. I contact many Mikrotik persons for this issue but all in vain.

    I am using RB750G 3.22v.

    Need help..

    Like

    Comment by Junaid — April 1, 2012 @ 11:02 PM

  68. Jahanzaib Bhai, i it Possible to have Load Balancer and Hotspot on same Machine?

    Like

    Comment by Danish Jamil — April 4, 2012 @ 11:42 PM

  69. Dear Syed,
    How can we use the web proxy with your configuration (not on a box of course..)?

    Like

    Comment by Alex Alouit (@alexalouit) — April 8, 2012 @ 7:49 PM

    • You mean like the one showed here ???

      Howto to enable Mikrotik RouterOS Web Proxy in Transparent Mode

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — April 9, 2012 @ 8:34 AM

      • Yes,
        unfortunately, for me it does not work.
        The proxy works fine from outside (lan network), but the internal drift does not work.

        My current config is:
        nat
        0 chain=srcnat action=masquerade src-address=192.168.2.0/24 out-interface=wan1
        1 chain=srcnat action=masquerade src-address=192.168.2.0/24 out-interface=wan2
        2 chain=dstnat action=redirect to-ports=3128 protocol=tcp src-address=192.168.2.0/24 dst-port=80

        mangle
        0 chain=input action=mark-connection new-connection-mark=WAN1_conn passthrough=yes in-interface=wan1
        1 chain=input action=mark-connection new-connection-mark=WAN2_conn passthrough=yes in-interface=wan2
        2 chain=output action=mark-routing new-routing-mark=to_WAN1 passthrough=yes connection-mark=WAN1_conn
        3 chain=output action=mark-routing new-routing-mark=to_WAN2 passthrough=yes connection-mark=WAN2_conn
        4 chain=prerouting action=accept dst-address=X.X.X.X/24 in-interface=lan
        5 chain=prerouting action=accept dst-address=X.X.X.X/24 in-interface=lan
        6 ;;; 80
        chain=prerouting action=mark-connection new-connection-mark=WAN1_conn passthrough=yes protocol=tcp dst-address-type=!local in-interface=lan dst-port=80 per-connection-classifier=both-addresses-and-ports:2/0
        7 chain=prerouting action=mark-connection new-connection-mark=WAN1_conn passthrough=yes dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/0
        8 ;;; 80
        chain=prerouting action=mark-connection new-connection-mark=WAN2_conn passthrough=yes dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses-and-ports:2/1
        9 chain=prerouting action=mark-connection new-connection-mark=WAN2_conn passthrough=yes dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/1
        10 chain=prerouting action=mark-routing new-routing-mark=to_WAN1 passthrough=yes in-interface=lan connection-mark=WAN1_conn
        11 chain=prerouting action=mark-routing new-routing-mark=to_WAN2 passthrough=yes in-interface=lan connection-mark=WAN2_conn

        proxy
        enabled: yes
        src-address: 0.0.0.0
        port: 3128
        parent-proxy: 0.0.0.0
        parent-proxy-port: 0
        cache-administrator: webmaster
        max-cache-size: none
        cache-on-disk: yes
        max-client-connections: 600
        max-server-connections: 600
        max-fresh-time: 3d
        serialize-connections: no
        always-from-cache: no
        cache-hit-dscp: 4
        cache-drive: primary-slave

        The router runs on Router OS 5.14

        Do you see that does not work?

        Regards

        Like

        Comment by Alex Alouit (@alexalouit) — April 9, 2012 @ 8:25 PM

      • Error in copy/paste, my mangle config number 8 is:
        chain=prerouting action=mark-connection new-connection-mark=WAN2_conn passthrough=yes protocol=tcp dst-address-type=!local in-interface=lan dst-port=80 per-connection-classifier=both-addresses-and-ports:2/1

        but it does affect my web proxy problem.
        The problem I encounter is also valid to intercept DNS requests (cache dns transparent).

        The firewall is it not challenged?

        Like

        Comment by Alex Alouit (@alexalouit) — April 10, 2012 @ 10:04 PM

      • use notepad +…paste there… and then copy from there and paste in new terminal…

        Like

        Comment by Acidu — April 11, 2012 @ 1:08 AM

      • For the copy/paste error, I spoke about the comment, not the CLI configuration of the router..

        Regards

        Like

        Comment by Alex Alouit (@alexalouit) — April 11, 2012 @ 5:43 PM

  70. Dear Sir
    I want to know these configuration also use with 750up router board ?
    I want load balancing with 2 wan on 750up router board …please help ….
    I also want load balancing using hotspot ……
    Regards

    Like

    Comment by faisalmirzapk — April 8, 2012 @ 8:15 PM

  71. Dear Sir

    plz help me mere pass RB750GL hai mey us pe 3 wan chalana chata ho with bondig (means merge all bandwidth ?) mere pass ye configuration hai.

    4Mb = 1st DSL router address = 192.168.0.1 => ehter1 WAN
    4Mb = 2nd DSL router address = 192.168.2.1 => ehter2 WAN
    6Mb = 3rd DSL router address = 192.168.3.1 => ehter3 WAN

    Bandwidth merge = 4Mb + 4Mb + 6Mb = 14Mbps

    local network = 192.168.1.1 => ehter5

    DHCP server on local network => ehter5

    Bandwidth controlling in Kbps on specific IP (local address)

    or kia interface ka name bhi change karna parey ga wo kese hoga ??? n plz help me step by step

    mey ne apki batae hui script mey changes ki hai wo nichy hai is mey koi mistake hai ? or baqi complete script send karden

    Thanks

    ————————————————————————————————————————————————————————————————————
    rename the interface
    ?????
    ————————————————————————————————————————————————————————————————————
    /ip address
    02 add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=Local
    03 add address=192.168.0.2/24 network=192.168.0.0 broadcast=192.168.0.255 interface=WAN1
    04 add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2
    05 add address=192.168.3.2/24 network=192.168.3.0 broadcast=192.168.3.255 interface=WAN3

    06 /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=221.132.112.8,8.8.8.8
    07
    08 /ip firewall mangle
    09 add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    10 add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
    11 add chain=input in-interface=WAN3 action=mark-connection new-connection-mark=WAN3_conn

    12 add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    13 add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2
    14 add chain=output connection-mark=WAN3_conn action=mark-routing new-routing-mark=to_WAN3

    15 add chain=prerouting dst-address=192.168.0.0/24 action=accept in-interface=Local
    16 add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.3.0/24 action=accept in-interface=Local
    17
    18 add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    19 add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN3_conn passthrough=yes
    20
    21 add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
    22 add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2
    23 add chain=prerouting connection-mark=WAN3_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN3

    24 /ip route
    25 add dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-mark=to_WAN1 check-gateway=ping
    26 add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping
    27 add dst-address=0.0.0.0/0 gateway=192.168.3.1 routing-mark=to_WAN3 check-gateway=ping

    28 add dst-address=0.0.0.0/0 gateway=192.168.0.1 distance=1 check-gateway=ping
    29 add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping
    30 add dst-address=0.0.0.0/0 gateway=192.168.3.1 distance=3 check-gateway=ping

    31 /ip firewall nat
    32 add chain=srcnat out-interface=WAN1 action=masquerade
    33 add chain=srcnat out-interface=WAN2 action=masquerade
    34 add chain=srcnat out-interface=WAN3 action=masquerade

    ————————————————————————————————————————————————————————————————————

    DHCP SERVER also

    ————————————————————————————————————————————————————————————————————

    Bandwith controlling

    ???????

    THANKS

    Regards

    Ehtisham Ul Haq

    Like

    Comment by Ehtisham Ul Haq — April 11, 2012 @ 12:18 PM

    • change the lines from

      18 add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
      19 add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN3_conn passthrough=yes

      TO below lines

      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:3/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:3/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:3/2 action=mark-connection new-connection-mark=WAN3_conn passthrough=yes

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — April 11, 2012 @ 1:14 PM

      • thanks Sir plz send me also interface rename script and DHCP server

        Like

        Comment by Ehtisham Ul Haq — April 11, 2012 @ 1:47 PM

      • Dear Sir

        this script is working in my case ??

        ip dhcp-server> setup
        Select interface to run DHCP server on

        dhcp server interface: local
        Select network for DHCP addresses

        dhcp address space: 192.168.1.0/24
        Select gateway for given network

        gateway for dhcp network: 192.168.1.1
        Select pool of ip addresses given out by DHCP server

        addresses to give out: 192.168.1.25-192.168.1.254
        Select DNS servers

        dns servers: 192.168.1.1
        Select lease time

        lease time: 3d

        Like

        Comment by Ehtisham Ul Haq — April 11, 2012 @ 2:11 PM

  72. Dear Bro. how can we use User Manager and manage users and their accounting on v3.3 with level4 license. if their some solution please tell me how can i do it.

    Like

    Comment by Junaid — April 11, 2012 @ 4:49 PM

  73. Hi, I have an address-list and want to force that all addresses in address-list ISP1 always goes to to WAN1, what should I do?

    Like

    Comment by Ari — April 26, 2012 @ 11:55 PM

  74. Hello, have you ever noticed redirect problem with NAT? I have the latest version of RouterOS on ESXi 5.
    I Can’t use the redirect (eg web proxy transparent, or transparent DNS cache).

    Like

    Comment by Alex Alouit (@alexalouit) — April 27, 2012 @ 3:59 PM

    • Here is my configuration:

      /ip firewall filter
      add action=drop chain=input disabled=no dst-port=3128 in-interface=wan1 protocol=tcp
      add action=drop chain=input disabled=no dst-port=3128 in-interface=wan2 protocol=tcp

      /ip firewall mangle
      add action=mark-connection chain=input disabled=no in-interface=wan1 new-connection-mark=WAN1_conn passthrough=yes
      add action=mark-connection chain=input disabled=no in-interface=wan2 new-connection-mark=WAN2_conn passthrough=yes
      add action=mark-routing chain=output connection-mark=WAN1_conn disabled=no new-routing-mark=to_WAN1 passthrough=yes
      add action=mark-routing chain=output connection-mark=WAN2_conn disabled=no new-routing-mark=to_WAN2 passthrough=yes
      add action=accept chain=prerouting disabled=no dst-address=0.0.0.0/24 in-interface=lan
      add action=accept chain=prerouting disabled=no dst-address=0.0.0.0/24 in-interface=lan
      add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=lan new-connection-mark=WAN1_conn passthrough=yes per-connection-classifier=both-addresses:2/0
      add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=lan new-connection-mark=WAN2_conn passthrough=yes per-connection-classifier=both-addresses:2/1
      add action=mark-routing chain=prerouting connection-mark=WAN1_conn disabled=no in-interface=lan new-routing-mark=to_WAN1 passthrough=yes
      add action=mark-routing chain=prerouting connection-mark=WAN2_conn disabled=no in-interface=lan new-routing-mark=to_WAN2 passthrough=yes

      /ip firewall nat
      add action=masquerade chain=srcnat disabled=no out-interface=wan1 src-address=0.0.0.0/24
      add action=masquerade chain=srcnat disabled=no out-interface=wan2 src-address=0.0.0.0/24
      add action=redirect chain=dstnat comment=”Transparent Web Cache” disabled=yes dst-port=80 protocol=tcp to-ports=3128

      /ip proxy
      set always-from-cache=no cache-administrator=webmaster cache-hit-dscp=4 cache-on-disk=yes enabled=yes max-cache-size=unlimited max-client-connections=600 max-fresh-time=3d max-server-connections=600 \
      parent-proxy=0.0.0.0 parent-proxy-port=0 port=3128 serialize-connections=no src-address=0.0.0.0

      /ip route
      add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=0.0.0.0 routing-mark=to_WAN1 scope=30 target-scope=10
      add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=0.0.0.0 routing-mark=to_WAN2 scope=30 target-scope=10
      add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=0.0.0.0 scope=30 target-scope=10
      add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=0.0.0.0 scope=30 target-scope=10

      Like

      Comment by Alex Alouit (@alexalouit) — April 27, 2012 @ 4:11 PM

    • I never used Mikrotik’s Web Proxy service with PCC. Only heard that it do make some problems if you have all setup on single box i.e PCC / Firewall / WEBPROXY. Its better to use external proxy for cache.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — April 28, 2012 @ 4:21 PM

  75. Hello

    Could you help me please.
    I am using 2 wan load balancing with PCC rules. But I want to use WAN1 generally and WAN2 if WAN1 is full.
    How can I do it.
    Also I use load balancing PCC with hotspot but there are problems when browsing https sites.

    Thanks a lot

    Best Regards
    Eynulla Samadov

    Like

    Comment by Eynulla Samadov — May 7, 2012 @ 7:11 PM

  76. Best tutorial, works from first attempt.
    Thank you for that.
    I have a small problem and wish that you can help me with.
    My board is RB493G (9 ports), I am using 2 ports for load sharing. Other ports for local net.
    The problem is that I fail to communicate with other ports now (I cannot access the shares nor ping my hosts ).
    I wish that you could help me solving this problem.

    Like

    Comment by Taha — May 12, 2012 @ 3:40 AM

  77. Thank you problem is solved no need to worry about it.
    What should be done is just create a prerouting chain with accept to each network segment. in /ip firewall mangle

    Like

    Comment by Taha — May 12, 2012 @ 7:17 PM

  78. Yes I am using hotspot .
    All I did to solve the problem is to create a mangle rule with accept from each segment to the other one.

    I have one problem left which is not related to the script of yours but being an expert in Mikrotik I would like to
    get your opinion on it.
    My RB is 493G (V5.16) with no wireless cards installed, instead I have an AP connected to one of the ETH2.
    I have 2 iPhones jail broken, connected to the same AP acting as the wireless HS I cannot see the shares between them.
    I have installed Multicast package still not working.

    If I connect the Iphones to an AP before the RB everything works fine. I would appreciate sharing your experience on solving this problem.

    Like

    Comment by Taha — May 14, 2012 @ 1:48 PM

  79. 1 /ip hotspot set address-pool=none——————————- could not do.. what are you referring to ?
    2 OR
    3 /ip hotspot set numbers=hotspot1 address-pool=none————– done—————–
    4 OR
    5 /ip firewall nat add chain=pre-hotspot dst-address-type=!local hotspot=auth action=accept—————— was already there——————-

    And problem is still there

    Like

    Comment by Taha — May 14, 2012 @ 2:47 PM

  80. hum apne server ki secript kaise jan sakte hain k hum ne us ko kia kia script di hai

    Like

    Comment by obaid — May 22, 2012 @ 8:49 PM

    • You can use Export command to get all mikrotik configuration in human readable format which will show you every bit of your router config.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — May 25, 2012 @ 8:53 AM

  81. sir i use your this script my mikrotik 3.30 L6 but just i wan line work not both at a time what happen? one time just 1 WAN work if i unplug 192.168.1.1 WAN1 then WAN2 work if i unplug wan2 then wan1 work but not both , if 2 wan are connectd wit then just WAN1 worked ? pleas help me what hapen?

    Like

    Comment by obaid — May 23, 2012 @ 10:50 AM

  82. Hello……i have a blue router address in Route List……..and one wan is working each time i disable the other not both at a time….any ideas??!!

    Like

    Comment by Leado — June 4, 2012 @ 10:08 PM

  83. Hi. I do have two dsl routers in bridge mode (different isps) and i need to have the pppoe (client) in my mikrotik 750. i need to have all the available bandwidth in one PC (192.168.200.50). what is the best script to use?
    router 1 is 10/1 Mbps with IP 192.168.2.1/24
    router 2 is 4/1Mbps with IP 192.168.10.254/24
    lan is 192.168.200.0/24

    some help plz!

    Like

    Comment by vortex — June 14, 2012 @ 9:56 PM

  84. Hello Sir,
    Thank you for this great tutorial. it worked for me in first attempt. I have one question though. I use download accelerator and when I download youtube videos with the download accelerator it spreads the load on the 2 wan interfaces that I have which is perfect. but when I watch youtube videos it only uses one of my wans.
    I tried to change the classifier to both-addresses-and-ports but still when watching youtube videos it only uses one. I am now using both-ports which works great for me in download accelerator, utorrent, and browsing. but still no luck when watching youtube videos.

    any advice.
    Your brother from Iraq
    Badr

    Like

    Comment by Badr — June 15, 2012 @ 4:26 PM

    • PCC don’t merge WAN Links, it only load balance request accross multiple connection.
      The more link you put on it, the better results you will get.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — June 16, 2012 @ 10:11 AM

      • how will i be able to merge wan links?

        Like

        Comment by vortex — June 16, 2012 @ 11:24 AM

  85. Hello Sayed Jahanzaib.
    Thank you for your quick reply. Do you have any tutorial on how to merge wan links or just something to start with?

    Thanks

    Like

    Comment by Badr — June 16, 2012 @ 3:07 PM

  86. Hi, zaiB
    I am Ali Muhamad from indonesia, could you help me please. I want to disable user using Software download manager eg: IDM or Toorent.

    My conection only 2 Mbps and will be use 20 pc client. If you can help me here is my email: oceaniatravel [AT ] DOT com

    Like

    Comment by Ali Muhamad — June 18, 2012 @ 7:52 AM

    • Actually it is difficult to block torrent.

      The best way is to limit there whole download bandwidth or impose bandwidth quota.
      OR you can mark packets for mp3 exe iso etc and restrict them using queue.

      OR another approach is to use Radisu and select quota plenty, for example if a user reaches 1 Gb quota for the day, his bandwidth drops half e.g from 512k to 256k.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — June 18, 2012 @ 8:45 AM

  87. i have WAN1=2mbps ip=192.168.1.64 gateway= 192.168.1.254 /WAN2=5mbps ip=192.168.2.100 gateway 192.168.2.1

    IS THIS CORRECT???

    /ip address
    add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
    add address=192.168.1.64/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1
    add address=192.168.2.100/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.4.4,8.8.8.8

    /ip firewall mangle
    add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

    add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

    add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
    add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.1.254 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.1.254 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

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

    Like

    Comment by Eduardo — June 21, 2012 @ 1:55 AM

  88. rb450g is enough for this operation with 50 hotspot clients?

    Like

    Comment by zeeshan — June 21, 2012 @ 6:01 PM

  89. As-Salam-Alaikum h r u .. dear..???

    i m new to use mikrotik server.. i don’t know abt it … i need ur help .. how to edit script .. and how to add .. 4mb and 1 mb lines in load balancing.. i have requested to upgrade my 1mb link to 4mb and hopefully it will be withing a couple of days… sir plx tell me how to edit hai configure script

    Regards
    Kashif Ali

    Like

    Comment by Kashif Ali — June 21, 2012 @ 6:37 PM

    • The script provided in this article is complete script to load balance 2 wan links.
      copy paste them in notepad and edit it as per your network / mikrotik configuration.
      You have to first learn basics of mikrotik. Goto forum / wiki / google , there are very good guides available there.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — June 22, 2012 @ 8:56 AM

  90. Hello……i have a blue router address in Route List……..and one wan is working each time i disable the other not both at a time….any ideas??!!

    Like

    Comment by Leado — June 22, 2012 @ 7:37 PM

  91. Could u please tell me how to add Script (notepad) file in Mikrotik???

    i don’t know about script editing.. please make a script for me .. one for load balancing and other for hotspot server.
    i have two 4mb DSL link of ptcl.. 🙂

    Like

    Comment by Kashif Ali — June 23, 2012 @ 8:25 PM

  92. Hello Mr Syed
    I’m using load balancin with NTH method because it collect the line , for ex. WAN1 (4M) + WAN2 (4M) = Download (8M) got transfer rat with IDM 1000 KB/S

    did PCC method do that ??? and can you help me how can i make port forward with NTH

    Like

    Comment by Ahmed Morgan — July 13, 2012 @ 8:29 PM

  93. Hello,
    this one doesn’t work for me:
    PCC WITH UN-EQUAL WAN LINKS
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    there is no traffic on this one…
    Can I use 3/0 for 1st, 3/1 for 2nd and 3/2 for wan1 again?

    I use per-connection-classifier=src-address.

    Best regards,

    Petar

    Like

    Comment by Petar — July 30, 2012 @ 1:02 AM

  94. Hello being unable to access my account in order to create a new post I would like to ask the question here:
    Is there a way to access the Mikrotik file system ? I have an RB450G and would like to delte some files at NAND level say : voltage.ko file.
    Thank you indvane for yrour help.

    Taha

    Like

    Comment by Taha — August 2, 2012 @ 7:38 AM

  95. i’ve tried the load balancing, internet and load balancing running well but i still can’t ping my router public address

    i monitor the traffic using torch, and i see RX traffic but no TX, seems the traffic can’t get back to the incoming ISP (traffic is receive but can’t reply)

    Like

    Comment by athan — August 30, 2012 @ 11:55 AM

  96. Salam Dear Sir ,

    Sir ap kasy hai .umied hai k ap thek hai .ALLAH ap per desta shufqat rakha.Sir main UBNT wireless setup laga raha hun.Aur sir mujha ap say kuch help ke zaroorat hai .wo ya k main us k liya mikrotik ka kon sa ver use karun uar mikrotik ruterbord kon sa purchas karun.qk es ma humara pass dedicated links be hai .aur SIR humara owner ya chata hai k ptcl jasie wireless modem ma setting ho.
    SIR Cache server be creat karna hai kindly ap us ka be bta dijya ga. Sir main umied karta hun k ap jaldi aur bhater jawab send kary gia.

    Waqas sabir from Faisalabad.
    E-mail = the2ndlastguy@yahoo.com
    Mob= 03157215729

    Comment by Muhammad Waqas Sabir

    Like

    Comment by Muhammad Waqas Sabir — September 2, 2012 @ 1:57 PM

    • Hardware requirements are based on number of clients that will be accessing the network resources.
      For smaller network, RB450, RB450G would be enough.
      For cache Server, if you have some know-how on Linux environment, then I will recommend you to go with SQUID proxy.

      Search my blog or Google, and you will find many helpful resources regarding configuring mikrotik/squid.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — September 3, 2012 @ 8:44 AM

    • a.a
      brother ma nay 4 wireless spot bany hn aur mikro tik dhcp use kar raha hn but jab ma hotspot use karta hn to mary 3 spot k andar any waly user thk say login hoty han par 1 spot asa ha jahan par user login hoty hi logout ho jata ha agur ip binding bi karon tab bi un users k pass login page ata ha problum ya ha k serprofile kam nahi karti but isi spot par default profile ko login karon to thk kam karti ha but sab users ko defalt profile to nahi day sakta
      kindly ap is ka hal jaldi batin
      phaly bi ap ko comment kya tha ap shyad hamary comments ko nahi dakhty
      kindly is bar ko positiv
      e feedback din
      cell no 0312-5741540

      Like

      Comment by basaam — September 12, 2012 @ 10:25 PM

      • without knowing technical specs, I cant comment.
        Post your config here. or email me.

        You can copy default profile and rename it as per requirements then make necessary changes.

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — September 16, 2012 @ 12:58 PM

  97. how does when i used internet soucer with DCHP?how?

    Like

    Comment by budi — September 18, 2012 @ 8:32 AM

  98. Asalam o Alikum sir
    mane 5 WAN ka load balancing banna ha kya ap mujhe source bana k mail kar sakty hain mera nam Zohaib Bin Khalid ha mane ek server banwaya tha jis na bana k diya tha os na password nai btaya or na hi mujhe back up diya mera server dead para howa ha plzzzz help kar dain
    mane 10 connection liya hain ptcl sa or sub k sub 10MB hain,,,,,,,,,,
    lucky_boy_zohaib@yahoo.com
    Zohaib Bin Khalid
    Pakistan Lahore

    Like

    Comment by Zohaib Bin Khalid — October 2, 2012 @ 7:37 PM

  99. I have used your PCC script , all is working fine with the PPPOE but when using hotspot its only sending traffic through 1 gateway . does not balance the traffic like in PPPOE

    Like

    Comment by Ferdi de Beer — October 5, 2012 @ 7:09 PM

    • to test i open 2x CMD in windows. then i use tracert to google and facebook . In PPPOE it shows that one user 192.168.4.1 and other 192.168.2.1 but in Hotspot only *.*.4.1

      Like

      Comment by Ferdi de Beer — October 5, 2012 @ 7:12 PM

  100. how to change the per connection classifier if we have a dual wan with the first port off 93Mbps and the second 11Mbps with the same gateway
    what’s the best solution to solve this .

    Like

    Comment by Agashi — October 6, 2012 @ 7:25 PM

  101. Hello, I setuped my L/B as exactly the way you showed us but i’m having Stream Issues, If I listen to youtube it always cut(stop)

    I have 10mb on wan1 and 6mb on wan2..

    Do you have any clue?

    Like

    Comment by dbRenaud — October 7, 2012 @ 8:49 AM

  102. Hello
    i have NanoStation M5 /RB SXT+ RB750 G.
    i connected both NM5 & SXT to two isp (pppoe). so i run dhcp server in this device.
    in 750g i used dhcp client to have internet. but when i use 2 dhcp client i cannot use both of them at the same time. and only one of them useing.
    how i can have both rb+nm5 internet in same time on 750g?
    i used this way:https://aacable.wordpress.com/2011/07/27/mikrotik-dual-wan-load-balancing-using-pcc-method-complete-script-by-zaib/

    Like

    Comment by Karim — October 7, 2012 @ 8:07 PM

  103. Syed , could u tell me is there a way to this scenario :

    WAN1 >>>>
    Mikrotik —–> Users with subnet 10.0.1.1/24 get internet from wan1 and users from subnet 10.0.2.1/24 gets internet from wan2 on same interface
    WAN2 >>>>

    is this possible in anyway to do it….

    Like

    Comment by agashi — October 9, 2012 @ 1:40 AM

  104. on everyway i doo , i get a issue with reaching radius vica versa .
    because when i route the second trafic to another gw then i do a tracert on it i get this :
    http://postimage.org/image/xyo4aitef/

    i’ve tried on routing it , adding a vpn to the main mikrotik but always i can’t reach radius …
    please can u help me on solving this .

    Like

    Comment by agashi — October 11, 2012 @ 2:18 PM

  105. sir i have a mikritik load balncind pcc mathod used, but is not working . sir 1 line is working butt 2 line is not working.
    i have used the mikrotik 3.30 . please solve my problem,sir i cal adeel ahmad but is not halpe me.

    Like

    Comment by naveed — October 31, 2012 @ 1:25 PM

  106. your script works like a charm. but when use external proxy (squid) with pcc load balancing, it’s not working since pcc seems to maintain all connection state between source and destination (both address & port). if i disable all pcc mangle rules, external proxy is wortking, http packets is redirected to squid, but it use only 1 gateway. is there any way to use external squid proxy with pcc load balancing ?

    Like

    Comment by lostbytes — November 10, 2012 @ 9:31 AM

    • I haven’t tried this scenario. Usually I use separate RB for LB. This way things dont get complicated when it comes to troubleshoot any problem.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — November 12, 2012 @ 10:26 AM

      • ahh…i see. that’s an option too, use 1st RB to do LB, then 2nd RB for guest & external proxy management. that’s a simple yet effective approach (and also cheap considering RB prices today). but it will be nice on research side if we can do the one RB option. Thank you for your reply, i will take your suggestion (apply 2 RB).

        Like

        Comment by lostbytes — November 12, 2012 @ 1:29 PM

  107. I have two internet connection. One is PTCL (4 Mb) and other one is World Call (2mb). I want to USE RB 750GL for the load margin and Load balancing. Can you please give complete script for that.

    Like

    Comment by Waqar — November 19, 2012 @ 12:37 PM

  108. i am using 2 ISP for load balancing. I have facing problem when i run my FTP at that time my FTP didt connect. But when i swith off one line my ftv works properly. How can i run the FTP on bouth lans.

    Like

    Comment by Waqar — November 27, 2012 @ 7:49 PM

  109. Dear Sir …
    I have 4 WAN pppoe client and one Local using RB450G, how can I marege and bond all those 4 PPPoE Clients if my ISP doesn’t support MLPPP .
    what should I do to merge all links ? any script ?
    Please Mr. Syed I need your help.
    Thanks.

    Like

    Comment by esalehnet — November 28, 2012 @ 8:30 PM

  110. Hi Sir,
    I have 4wan pppoe client and 1 local network, hot to merge all those pppoe client if my ISP doesn’t support MLPPP ? any script ?
    what should I do in this case ?
    I need your help.
    Thank you very much.

    Like

    Comment by esalehnet — November 28, 2012 @ 9:04 PM

  111. i am using 2 ISP for load balancing. I have facing problem when i run my FTP at that time my FTP didt connect. But when i swith off one line my ftv works properly. How can i run the FTP on both Lans, I try your script. But i still i have problem . can u explain it more for me

    Like

    Comment by Waqar — November 29, 2012 @ 7:03 PM

    • Wich Is the Best Methord Pcc Or Nth ?

      Like

      Comment by usma — December 9, 2012 @ 12:45 AM

  112. i have Question about Mikrotik Loadbalancing

    First if i have Two Wan 2Mb/s , with this method My Download Speed Increase to 4Mb/s ? (Download 1 file with 4 Mb/s )

    Another Question : i Think if i Established PPTP Vpn Connection on my Client PC it just Use one WAN , But if i Established PPTP on my Mikrotik i think it use 4Mb/s Tunnel and Direct Two WAN to Tunnel . is it Correct ? if yes can help me how can i Established PPTP Client on My Mikrotik and Direct 2 Wan on That tunnel ? ( i have 4Mb/s Tunnel )

    Regards .

    Like

    Comment by Mehran — December 9, 2012 @ 2:13 PM

  113. salaM mere Pas mikrotek hotspot connection he…mgr porblem ye he her baar login hona parta he…kia koi aisa method nai jis se auto login mumkin ho sake….

    Like

    Comment by raheel — December 12, 2012 @ 1:43 PM

  114. I Did it , and it work well . but just in Download manager it work well cause its Split connection and download with Two wan .

    In Video Stream or many other things they use just One connection it use 1 Wan . there is no Way I can Split 1 Connection to 2 connection and see Video streaming or others with two wan ?

    Thanks .

    Like

    Comment by Mehran — December 13, 2012 @ 11:34 AM

  115. Is That possible to pass Torrents from 4th Gateway only

    please tell me example code for it.

    Like

    Comment by shahzad — December 14, 2012 @ 12:10 PM

  116. I have here a situation with my dual WAN Load Balancing.
    WAN2 = 384kb LS
    WAN1 = 6Mb ADSL

    Load Balancing on RB433

    after this, WAN2 is fully used but WAN1 hardly reaches 2Mb and at the moment the LAN is reaching 1.5Mb, browsing is becoming almost impossible.
    My VOIP Calls are not more clear
    Using WAN1 alone, easily reaching 4Mb with no problem and can also Call.
    Plz Help

    Here is the configuration:

    /ip address
    add address=192.168.1.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
    add address=192.168.2.2/24 network=192.168.1.0 broadcast=192.168.2.255 interface=WAN1
    add address=192.168.11.2/24 network=192.168.11.0 broadcast=192.168.11.255 interface=WAN2

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=221.132.112.8,8.8.8.8

    /ip firewall mangle
    add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

    add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

    add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.11.0/24 action=accept in-interface=Local

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
    add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.11.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.11.1 distance=2 check-gateway=ping

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

    /ip firewall mangle
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes

    Like

    Comment by warren — December 14, 2012 @ 10:51 PM

    • Hi Warren,

      I am using 2 ISP with PCC method. But i am facing a problem with the FTP. When i try to upload through Filezilla my connect disconnect when both wan are working. But when i disable the one Wan i ma able to do a upload. Can you pleaes tell me how can i make my FTP working with both lan. Or how can i exempt the IP from PCC rule.

      Like

      Comment by waqar — December 15, 2012 @ 8:38 PM

      • Define your network topology in detail.
        If users are hitting directly to PCC , then you can use src-address as classifier as this way change of WAN ip wont occur for the user , for the session he initially build with pcc. he will always be bound with the WAN that he initially connected to.

        Or you can also exclude some Users ip / Traffic from being processed by pcc, means you can bypass certain traffic from being processed by the PCC, and this tagged tarffic will go via specific WAN only,

        Howto Exempt any User / Website from Mikrotik PCC [Part-1]

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — December 16, 2012 @ 10:24 AM

  117. Here is my new config but no change

    WAN1 = 384kb LS
    WAN2 = 6Mb ADSL

    /ip address
    add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=Local
    add address=192.168.11.2/24 network=192.168.11.0 broadcast=192.168.11.255 interface=WAN1
    add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=221.132.112.8,8.8.8.8

    /ip firewall mangle
    add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

    add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

    add chain=prerouting dst-address=192.168.11.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
    add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.11.1 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.11.1 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

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

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    Like

    Comment by Warren — December 16, 2012 @ 9:06 PM

    • Will this force Local to send more traffic to WAN2 ?

      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:5/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:5/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:5/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:5/3 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
      add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:5/4 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

      Like

      Comment by Warren — December 17, 2012 @ 3:26 AM

  118. […] view source […]

    Like

    Pingback by Mikrotik DUAL WAN Load Balancing using PCC method. Complete Script ! by zaiB | @rskabc — January 28, 2013 @ 7:16 AM

  119. Hello Bhai..
    main 2 adsl(ptcl) modem ki loadbalancing ki huwi hai. using PCC method. its fine, . lakin jab aik Line disconnect hoti hai tu browsing main GateWay Timeout ka error aata jata hai. So how i can solve this problem….???? iam waiting for response
    thank you
    Hammad Hassan
    Fast ISP

    Like

    Comment by hammad hassan — February 5, 2013 @ 5:51 PM

  120. Assalamuaikum…
    thank you for this tutorial, but i have a question about :

    /ip firewall mangle
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes

    –> for that example “!local” [accept local]

    what is the ip address for local list..? there’s only ip address for client connection, or any others one..?

    thank you for help me..

    Wassalamualaikum…
    Ronny

    Like

    Comment by Ronny Siswongso Nugroho — February 14, 2013 @ 2:39 PM

  121. Dear Sayed Jahanzaib…

    I have a pcc load balance where:

    WAN1: 8M up / 8M down (for direct connections)
    WAN2: 8M up / 8M down (for direct connections)
    WAN3: 35M down from sat (for port 80 connections)

    we are routing our sat subnet to use it for port 80 connections and every thing is ok…

    but we want to stop our sat down and upgrade our WAN2 to become 25M up / 50M down
    what we need is to divide the WAN2 bandwidth between the direct connections and port 80 connections
    to be like this :

    WAN1: 8M up / 8M down (for direct connections)
    WAN2: 8M up / 8M down (for direct connections)
    WAN2: 17M up / 42M down (for port 80 connections)

    ether2: my local lan
    ether3: my WAN1 (25M up / 50M down)
    ether4: my WAN2 (8M up / 8M down)

    what I need is to separate http connection from the PCC load balance and must pass from ether3 only …
    so can I solve it in this way ? :

    /ip address
    add address=192.168.1.1/24 disabled=no interface=ether2 network=192.168.1.0
    add address=1.1.1.2/24 disabled=no interface=ether3 network=1.1.1.0
    add address=2.2.2.2/24 disabled=no interface=ether4 network=2.2.2.0

    PCC load balance with marking http connection:

    /ip firewall mangle
    add action=mark-connection chain=forward disabled=no dst-port=80 new-connection-mark=http_conn passthrough=yes protocol=tcp src-address=192.168.1.0/24
    add action=mark-packet chain=forward connection-mark=http_conn disabled=no dst-port=80 new-packet-mark=http passthrough=no protocol=tcp src-address=192.168.1.0/24

    add action=accept chain=prerouting comment=ether3 disabled=no dst-address=1.1.1.0/24 in-interface=ether2
    add action=accept chain=prerouting comment=ether4 disabled=no dst-address=2.2.2.0/24 in-interface=ether2

    add action=mark-connection chain=prerouting comment=ether3_conn connection-mark=no-mark disabled=no in-interface=ether3 new-connection-mark=ether3_conn passthrough=yes
    add action=mark-connection chain=prerouting comment=ether4_conn connection-mark=no-mark disabled=no in-interface=ether4 new-connection-mark=ether4_conn passthrough=yes

    add action=mark-connection chain=prerouting comment=ether3_conn connection-mark=no-mark disabled=no dst-address-type=!local in-interface=ether2 new-connection-mark=ether3_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1
    add action=mark-connection chain=prerouting comment=ether4_conn connection-mark=no-mark disabled=no dst-address-type=!local in-interface=ether2 new-connection-mark=ether4_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0

    add action=mark-routing chain=prerouting comment=”ether3_packet mark” connection-mark=ether3_conn disabled=no in-interface=ether2 new-routing-mark=to_ether3 passthrough=yes
    add action=mark-routing chain=prerouting comment=”ether4_packet mark” connection-mark=ether4_conn disabled=no in-interface=ether2 new-routing-mark=to_ether4 passthrough=yes

    add action=mark-routing chain=output comment=”ether3_packet mark” connection-mark=ether3_conn disabled=no new-routing-mark=to_ether3 passthrough=yes
    add action=mark-routing chain=output comment=”ether4_packet mark” connection-mark=ether4_conn disabled=no new-routing-mark=to_ether4 passthrough=yes

    /ip firewall nat
    add action=accept chain=srcnat disabled=no dst-port=80 out-interface=ether3 protocol=tcp
    add action=masquerade chain=srcnat disabled=no out-interface=ether3
    add action=masquerade chain=srcnat disabled=no out-interface=ether4

    /ip route
    add check-gateway=ping comment=”Load balance_ether3″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=1.1.1.1 routing-mark=to_ether3 scope=30 target-scope=10
    add check-gateway=ping comment=”Load balance_ether4″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=2.2.2.1 routing-mark=to_ether4 scope=30 target-scope=10
    add check-gateway=ping comment=”Load balance_ether3″ disabled=no distance=1 dst-address=0.0.0.0/0 gateway=1.1.1.1 scope=30 target-scope=10
    add check-gateway=ping comment=”Load balance_ether4″ disabled=no distance=2 dst-address=0.0.0.0/0 gateway=2.2.2.1 scope=30 target-scope=10

    /queue simple
    add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s direction=both disabled=no interface=all limit-at=0/0 max-limit=17M/42M name=”HTTP Queue” packet-marks=http parent=none priority=8 queue=ethernet-default/ethernet-default target-addresses=”” total-queue=default-small

    Like

    Comment by Fiber Net — February 17, 2013 @ 3:14 PM

  122. sorry edit :
    ether2: my local lan
    ether3: my WAN2 (25M up / 50M down)
    ether4: my WAN1 (8M up / 8M down)

    Like

    Comment by Fiber Net — February 17, 2013 @ 3:26 PM

  123. i have rb 1100
    . ether 1: pppoe client ,local
    ether 2: pppoe client ,local
    ether 3: pppoe client ,local
    ether 4: pppoe client ,local
    ether 5: pppoe client ,local
    ether 6: pppoe client ,local
    all ether 1,2,3,4,5,6 have the same network 192.168.1.0 with DHCP 192.168.1.1/192.168.1.254
    and i wont the output hotspot

    Like

    Comment by absal — February 18, 2013 @ 11:52 PM

  124. Asslam o Alaikum sir i am using rb 750 for loadbalcing in which 2 mb 4 mb 4mb connection used after dat os on syatem usinf pppoe net share bt ther is a problem that i used skype dafual speed gives me error ur net speed is slow give me solution plz

    Like

    Comment by waqar — February 26, 2013 @ 6:47 PM

  125. Can the setup work for me.
    I have to ISP, one is USM(ppp-client USB dongle) and the other one is with a router to mikrotik thru ether1.
    My Lan is on port 3 (hotspot-193.168.30.1/24),
    ether2 (10.11.6.1/24) and wlan1(192.168.2.1/24).

    I want a situation where the ppp-client USB will be my primary ISP (WAN1) and My secondary ISP will be from (ether1).

    How will my settings or configuration be so that if primary isp is down, the secodnary will come up and if primary comes up, it switches over to it.

    Like

    Comment by sapanda — March 5, 2013 @ 4:41 PM

    • You can setup netwatch to monitor wan connectivity usnig your specific primary interface, so when it stops receive response from google for example, then it should switch over to secondary ISP.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — March 6, 2013 @ 7:55 PM

  126. hello,
    i want to limit users internet bandwidth but i am having problem with internal connection. the internal bandwidth is also limited and it is affecting VOIP on the network. how can i solve this issue.
    thank you. i love your post and am a huge fan of yours…

    Like

    Comment by Rene — March 5, 2013 @ 8:32 PM

    • Its depend on the scenario.
      Are you running HOTSPOT ?

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — March 6, 2013 @ 8:53 AM

      • Yes. am running hotspot on the network

        Like

        Comment by Rene — March 8, 2013 @ 4:07 PM

      • HOTSPOT users can’t communicate with each other on LAN or PROXY-ARP issue

        If you face hotspot broadcast issue / arp-poisoning , problem, Remove the address pool from the Hotspot to turn off Universal NAT,
        /ip hotspot set address-pool=none
        OR
        /ip hotspot set numbers=hotspot1 address-pool=none
        OR
        /ip firewall nat add chain=pre-hotspot dst-address-type=!local hotspot=auth action=accept

        Like

        Comment by Syed Jahanzaib / Pinochio~:) — March 10, 2013 @ 7:14 PM

      • the trixbox server is in the network. i want a situation where users would not be limited to the bandwidth given to them to access anything on the LAN. i already added the IP address of the sip server to bind and bypassed it; but its still slow and something jerky calls.

        Like

        Comment by Rene — March 11, 2013 @ 12:58 AM

  127. Kindly describe this issue
    I am using ppc load balancing
    When I use torch tool I see this
    Dst. Vlan Tx Rate Rx Rate Tx Packeg
    0.0.0.0 143.2Kbps 3.5Mbps 219

    Like

    Comment by Ehtisham — March 8, 2013 @ 1:28 AM

    • tx means mikrotik is transmitting traffic to requesting target. Usually UPLOAD traffic
      rx means mikrotik is receiving traffic from the source. Usually Internet

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — March 10, 2013 @ 7:16 PM

      • Thanks Bhai

        Like

        Comment by Ehtisham — March 31, 2013 @ 1:56 AM

  128. is it possible to achieve the config through winbox? i have 2 adsl connections 15/1Mbps each one and i like to get them on my mikrotik 750 to get higher throughput and redundancy in case of one link fails. they are different ISPs and i can turn its modems in bridge mode.
    i have one network 192.168.190.0/24

    Like

    Comment by aris — March 11, 2013 @ 7:02 PM

  129. AoA,

    I need to know how to setup 2 adsl lines that traffic that coming to me(inbound) should be load balanced like web server hosted at my home does it work with mikrotik or dns load balancing will be required?

    Like

    Comment by gmsq — March 24, 2013 @ 6:31 PM

  130. hi
    thanks for script
    i use this script for 2 links 1 adsl (2m) and 1 wireless internet link (2m)
    load balancing work well and combine 2 link ==>4m download but fail over not work correctly
    so test this i disconnect modem telephone cable and internet disconnected because ping rule only check next hop of internet link and not understand internet link is down
    i try resolved this problem with tool/netwatch and check 8.8.8.8 but not success
    can you help for improve fail over method with load balancing
    tanks a lot

    Like

    Comment by saeed — April 6, 2013 @ 8:45 PM

  131. Aslam O Alikum Syed Jahanzaib

    I am Tanveer ul isalm from Saudi Arabia, I just configure PPPoe and it working fine, but i have tow WAN connection. How i cam make only fail over. i no need loadbalance. please help me urgent or i want to monitor two wan IP ( yahoo or google), if it will not ping then it will shif to other gateway. if you can help in gui mode. Thanks in Advance.

    Regards,
    Tanveer

    Like

    Comment by Tanveer ul islam — April 10, 2013 @ 7:50 PM

  132. What do I Need to Change to have 4 LAN Interfaces with different Networks in your script?
    Do I Need to add These additional LAN ports simply to the following lines and thts it or do I Need to Change more?
    add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.3.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.4.0/24 action=accept in-interface=Local

    Like

    Comment by Dirk — May 6, 2013 @ 6:55 PM

  133. i have 2 ISP primary is 192.168.10.10/24 connected to port ether 1 secondary is 10.10.10.10/24 connected on port ether 2 and LAN is 172.16.0.1/16 connected on port ether3. please kindly provide me the dual ISP fail-over scripts.

    Like

    Comment by Naveed — May 12, 2013 @ 3:00 PM

  134. Hi there!
    I will like to set up 2 WAN Load Balancing using PCC method. but these two line are not equal. the first one has 06mb and the second one has 1mb. all are Optic Fiber links. can someone please advice?

    Like

    Comment by Alex — May 29, 2013 @ 2:54 AM

  135. Hello Sir,

    I was wondering if it is possible to load balance more than 30 PPPOE connections. What mikrotik router do you advice? What is your advice in load balancing that many connections?

    Like

    Comment by HRDHKR — July 9, 2013 @ 2:52 AM

    • I will not recommend you to go with that much pppoe connections, as troubleshooting will become very hard.
      anyhwo still you can do it, downloading larger files with idm type tools will be greatly benefited. No RB have 30 ports, however you can use VLAN technology to do as much as ports config you like. I once saw 22 WAN LB at a friends rb suing this tech.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — July 9, 2013 @ 8:09 AM

  136. Hi,
    I am using RB 1100 of V6.0rc11

    I have two internet connections.
    One connection gives static Ip Address ie. on ether10 —- 111.112.113.114 (ISP1)

    and other is PPPOE Connection gives dynamic ip address on ether9 (ISP2)

    I have LAN on ether1 —– 192.168.0.0/24

    my nat rule is
    add action=masquerade chain=src-nat Src. Address=192.168.0.0/24 out-interface=ISP1 (internet for all)

    i tried
    add action=masquerade chain=src-nat Src. Address=192.168.0.100 out-interface=ISP2 (internet for particular computer)

    And
    add action=masquerade chain=src-nat Src. Address=192.168.0.101 out-interface=ISP1 (internet for particular computer)

    What I want is to route all traffic from ISP2 of ip —192.168.0.100 and ip–192.168.10.101

    Please Help

    Like

    Comment by cool nicq — July 13, 2013 @ 2:42 PM

  137. bhai kia hum is script k saat quality of service ko apply kar saktey hain or kese kindly guide,we are facing problem with browsing although downloading speed is fine.

    Like

    Comment by Ehtisham — August 14, 2013 @ 2:57 PM

    • Hi … I’m using LB with 8 PPPoE Clients and all working fine.
      I having problem with the smtp port 25 in outlook, all users can recieve emails by pop3 port 110, but they cannot do send.
      When I connect all users direct to one PPPoE client without using LB like a simple router, they can sends emails smoothly.
      I’ve add a rule in the mangle with prerouting chain, TCP Protocol, Dst. Port 25 and action accept, and nothing.
      Please what should I do to fix this problem ?
      Help…

      Like

      Comment by esalehnet — August 19, 2013 @ 3:21 PM

  138. Hello Syed,

    Below find config related to Mikrotik RB750G router, running 6.0rc9.

    I am trying to configure ISP redundancy in load-balancing mode through a PCC article.
    I have three connected interfaces, LAN, WAN and WAN2. The Primary and secondary WAN connections have different speed.

    Issue is that after configuring the router, I get no traffic on one of the firewall>mangle prerouting chain rules (for WAN). The same applies when I disable the secondary interface (WAN2) there is no automatic changeover to the primary interface.

    Some observations I’ve noted through WebFig are the following:

    Interface>Interface – Ok, Traffic being Transmitted and Received on all three interfaces
    Interface>Ethernet – Ok, Traffic being Transmitted and Received on all three interfaces

    DNS – Four set, two for one ISP and two for the other ISP

    Firewall>NAT – seems ok, traffic being transmitted and received on all interfaces

    Firewall>Mangle – there seems to be an issue here since there is no packets (counter still at 0), are flowing for primary ISP network addresses.
    Rule is as follows:
    /ip firewall mangle
    Add chain=prerouting dst-address=XXXX action=accept in-interface=LAN
    —————–

    Note that all seems ok with the remaining prerouting (mark connection and mark routing) rules, since traffic is flowing. This includes the prerouting rule for the other WAN link.

    Routes>Primary ISP Gateway is unreachable for static routes

    Routes>Nexthops
    Primary and secondary gateways are reachable for both nexthops

    Below I am including extracts of the config.
    (Please note that IP addresses/MAC Addresses have been left out and replaced with Text).

    Should you require further info please let me know

    [admin@MikroTik] /interface> print
    Flags: D – dynamic, X – disabled, R – running, S – slave
    # NAME TYPE MTU L2MTU MAX-L2MTU MAC-ADDRESS
    0 R WAN ether 1500 1520 1520 –
    1 R LAN ether 1500 1520 1520 –
    2 R WAN2 ether 1500 1520 1520 –
    3 XS ether4-slave-local ether 1500 1520 1520 –
    4 XS ether5-slave-local ether 1500 1520 1520 –

    [admin@MikroTik] /ip address> print
    Flags: X – disabled, I – invalid, D – dynamic
    # ADDRESS NETWORK INTERFACE
    0 ;;; default configuration
    192.168.88.1/24 192.168.88.0 LAN
    1 ;;; Internet Primary
    ISP1 IP Address [ISP1 Network Address] WAN
    2 ;;; Internet Secondary
    ISP2 IP Address [ISP2 Network Address] WAN2

    [admin@MikroTik] /ip firewall mangle> print
    Flags: X – disabled, I – invalid, D – dynamic
    0 chain=prerouting action=accept dst-address=[ISP1 Network Address] in-interface=LAN
    1 chain=prerouting action=accept dst-address=[ISP2 Network Address] in-interface=LAN

    2 chain=prerouting action=mark-connection new-connection-mark=WAN_conn passthrough=yes
    in-interface=WAN connection-mark=no-mark

    3 chain=prerouting action=mark-connection new-connection-mark=WAN2_conn passthrough=yes in-interface=WAN2 connection-mark=no-mark

    4 chain=prerouting action=mark-connection new-connection-mark=WAN_conn passthrough=yes
    dst-address-type=!local in-interface=LAN connection-mark=no-mark
    per-connection-classifier=both-addresses:2/0

    5 chain=prerouting action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    dst-address-type=!local in-interface=LAN connection-mark=no-mark
    per-connection-classifier=both-addresses:2/1

    6 chain=prerouting action=mark-routing new-routing-mark=to_WAN passthrough=yes
    in-interface=LAN connection-mark=WAN_conn

    7 chain=prerouting action=mark-routing new-routing-mark=to_WAN2 passthrough=yes
    in-interface=LAN connection-mark=WAN2_conn

    8 chain=output action=mark-routing new-routing-mark=to_WAN passthrough=yes
    connection-mark=WAN_conn

    9 chain=output action=mark-routing new-routing-mark=to_WAN2 passthrough=yes connection-mark=WAN2_conn

    ————–

    [admin@MikroTik] /ip firewall nat> print
    Flags: X – disabled, I – invalid, D – dynamic

    1 chain=srcnat action=masquerade out-interface=WAN

    2 chain=srcnat action=masquerade out-interface=WAN2

    ————–

    [admin@MikroTik] /ip route> print
    Flags: X – disabled, A – active, D – dynamic, C – connect, S – static, r – rip, b – bgp, o – ospf, m – mme,
    B – blackhole, U – unreachable, P – prohibit
    # DST-ADDRESS PREF-SRC GATEWAY DISTANCE
    0 0.0.0.0/0 ISP1 Gateway 1
    1 0.0.0.0/0 ISP2 Gateway 2
    2 0.0.0.0/0 ISP1 Gateway 1 (routing mark to_WAN)
    3 0.0.0.0/0 ISP2 Gateway 2 (routing mark to_WAN2)
    4 ADC 192.168.88.0/24 192.168.88.1 LAN 0
    5 ADC ISP1 Network Address ISP1 Static IP WAN 0
    6 ADC ISP2 Network Address ISP2 Static IP WAN2 0

    Like

    Comment by Joseph Lee Lemon — August 27, 2013 @ 5:45 PM

  139. rocket m2 kay ubnt sactor 120 degree ka laga hi
    1 km par 72 mb par conect ho kar thori dair tak 1 mb par a jata hi
    ya masla samaj nhi a raha plz help me

    Like

    Comment by rashid — September 3, 2013 @ 3:05 PM

  140. Hello Syed,

    Any Idea on 139, i.e. ISP redundancy with PCC

    Much obliged,

    Joe

    Like

    Comment by Joseph Lee Lemon — September 4, 2013 @ 6:15 PM

  141. Plz help me with a scrip for RB750

    Like

    Comment by tanveer — September 29, 2013 @ 9:53 PM

  142. does this method consume traffic from both links equally ??

    Like

    Comment by Khuffash — October 3, 2013 @ 5:38 PM

  143. we are using 3 WAN connection, i study ur documents which helps a lot, internet is working fine but the problem is that when i use web email or remote desktop from outside network (abroad) its drops after some time, can you please guide me how to fix this issue.

    Like

    Comment by Friends — October 10, 2013 @ 1:06 PM

  144. but what if i do this in ip routes ??
    what is the diffrance between the picture and between ur route role ??

    or

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

    Like

    Comment by qassam mahmoud — October 18, 2013 @ 10:32 PM

  145. Bhai,
    Assalamu Alaikum Wa Rahmatullah. I am Kawsar from Bangladesh. I just configured your given 2XWan Script on My Mikrotik 450G and put two modem (1XWimax-2MB Line+1XADSL-512 Kbps). Every script is okey. But my system is not working. I am not clear which DNS should I use and also is there any necessity to put up real IP which has given by two ISP (1 from Wimax and 1 from ADSL)? I didn’t put that. Here I am giving the whole script which I have given to my Mikrotik. If you see and help me. I will be grateful.

    Please have a look with my used script.

    /ip address
    add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
    add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1
    add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=221.132.112.8,8.8.8.8

    /ip firewall mangle
    add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

    add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

    add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
    add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

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

    Thanks
    Kawsar
    +8801711865172
    mdsekawsar@gmail.com

    Like

    Comment by Md Sarwar E Kawsar — November 4, 2013 @ 10:24 PM

  146. Hi Sir

    I have 2 Dynamic IP Addresses (dsl) lines…. I am using Afraid.org auto dns updater… the system is load balancing setup…. It seems to be working fine, untill both dynamic ip addresses change on the wan 1 and wan 2….. is there a script that can force my IP updater to go only through wan 1, or through wan 2 which I can select myself?…. It somehow seems to affect my voip system as well… now i have to reboot my voip server everytime the IP changes as well…

    Kind regards

    Like

    Comment by jackalt007Nizam — November 7, 2013 @ 2:46 AM

  147. sir ,
    jab main yeh 2 wan lod balniceing karta ho to interface main rx errors ata ha plz reply

    Like

    Comment by shshid — November 8, 2013 @ 11:34 AM

  148. why do u use
    add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
    I mean “192.168.1.0/24” and “192.168.2.0/24”. Because this is WAN network. This is not my property. This is service provider’s network.
    Please explain me.
    Thanks in advance.

    Like

    Comment by myfahimFahim Ahmed — November 19, 2013 @ 3:15 PM

    • Thanks Dear,

      I just update my wimax modem local IP as 192.168.1.0/24 and 192.168.2.0/24. That’s why I used those twice IP as well. One thing let me describe you. When I just start the two wimax modem at a time just WAN1 modem is using. If I make disable WAN1 then WAN2 is automatically starts its duty. Means this time WAN2 is working. At a time both is not working. I would like to get both modems data means (WAN1-2MB and WAN2-2MB=Local-4MB). Is it possible to get 4 MB download speed at a time by the said two wimax modem?

      Thanks
      Kawsar
      mdsekawsar@gmail.com
      +8801711865172

      Like

      Comment by Md Sarwar E Kawsar — November 20, 2013 @ 10:36 PM

      • I have configured my router another way. In my LAN, I have devided my network into two (e.g. 10.10.10.0/25 and 10.10.10.128/25). The first subnet is going twards WAN1 and second subnet going twards WAN2. It is working fine. But I want something which will work dynamically. I don’t wanna define subnet. I don’t wanna select user to go to some specific WAN.

        Like

        Comment by Fahim — November 25, 2013 @ 8:02 AM

  149. Dear I have purchased a mikrotik rb750 . and I want you to configure it for me. with hotspot login page. how much will u charge for it. plz contact me @ 0333-6107719 or send me email at m.arfanzahid@yahoo.com

    Like

    Comment by Arfan — November 23, 2013 @ 2:19 PM

  150. Hello,
    I have two Fiber Optic links with /29 IP subnet and gateway IP is on ISP hardware(so I can only use 5 public IPs from each link) , how can I configure Loadbalancer to fit my scenario???.I have tried the script but it force traffic only to one link the second not working or when I disconnect the first one it’s start to force to second one.
    Thank you in advance

    Like

    Comment by Mojitos_82 — December 12, 2013 @ 4:02 AM

    • It depends on how your mikrotik box is configured with other services. If only one link is in used, probably something in config is configured incorrectly.
      Once PCC script cannot fit in all environment, for example, if you have PCC with PPPoE server in box, or PCC with HOTSPOT, or simple PCC as a gateway, settings are different for each scenario.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — December 12, 2013 @ 8:24 AM

      • Hi,
        Thank’s for reply, I need simple pcc loadbalancer .But I preffer to use loadbalancing on my PPPoE concentrator directly, on RB1100AH . Is it possible?
        I have configured for now PORT 13 as WAN port and port 6 as LAN master and the rest port 7-10 as slave ports ,11-12 ports don’t have idea how to use them.I running ROS 6.6 on RB.
        Please help!

        Like

        Comment by Mojitos_82 — December 13, 2013 @ 11:37 PM

  151. hi,
    please sir, i want to know if it is possible to use two 2 internet service provider, isp1 for browsing and isp2 for downloading on mikrotik, thank you

    Like

    Comment by lateef — December 26, 2013 @ 5:29 PM

  152. hi
    sir my question is the rb 740 can combine 4 network for example 10Mb+10Mb+10Mb+10Mb combine 40Mb it is possible

    Like

    Comment by imran rasool — January 14, 2014 @ 10:25 PM

  153. Dear sir assalamo alaikum
    sir i am having a problem on my network dhcp lease busy and that time whole the network yellow sign and not accept any ip address manually kindly tell me the solution i am very upset for this problem i am using mikrotik 5.20 hotspot

    Like

    Comment by Muhammad Ali — January 17, 2014 @ 2:00 AM

  154. I have 2 wan with 4 and 8 mbps. Which one of the following pcc is correct.

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    OR

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:3/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:3/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:3/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    Notice the ‘2’ and ‘3’ in the pcc..

    Thank you for the answer.

    Like

    Comment by freerhyme — February 11, 2014 @ 12:03 PM

  155. How to update this script if i have one WAN with PPPoE and both WANs has adresses from DHCP and may change?
    I can use 192.168.1.1. and 192.168.2.1. Can it be changed to interface?

    Like

    Comment by LiveBomb — February 24, 2014 @ 2:48 PM

  156. i have 2 Wan, of 4mb each, WAN1 has download volume of 102gb, WAN2 no volume quota: i wish to load balance my surf to WAN1 and all downloads to WAN2: can you help me please;i have a network which clients can download more than 200gb per month and need to reduce cost

    Like

    Comment by loknjinu — March 3, 2014 @ 3:29 PM

  157. Is it possible on MikroTik i can LoadBalancing with Single Socket Connection ? i mean For Streaming Video and etc it just use one Session , Connectify Switchboard is a Application can do it and used Multiple Internet Connection for Streaming Videos .

    Now i want know Mikrotik is able to do that ?

    -Thanks .

    Like

    Comment by Mehran — March 15, 2014 @ 3:33 PM

  158. hello, thanks for your great works with this blog but I would like to find out;
    I recently bought an RB2011 and I’m expecting my ISP to install a second connection.

    Can I have the load balancing as well as hotspot setup on the same router?
    Thanks,
    Max

    Like

    Comment by maxcuban — March 24, 2014 @ 1:20 PM

  159. hi,
    I have written on many forums without ever answer, but I need help, I have 2 WAN from a 4mb and from a 7mb, I would like to achieve load balancing and I used this script

    /ip address
    add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=Local
    add address=192.168.10.2/24 network=192.168.1.0 broadcast=192.168.10.255 interface=WAN1
    add address=192.168.20.2/24 network=192.168.2.0 broadcast=192.168.20.255 interface=WAN2

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=217.112.96.190,8.8.8.8

    /ip firewall mangle
    add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
    add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn

    add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
    add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2

    add chain=prerouting dst-address=192.168.10.0/24 action=accept in-interface=Local
    add chain=prerouting dst-address=192.168.20.0/24 action=accept in-interface=Local

    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/2 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
    add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.10.1 routing-mark=to_WAN1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.20.1 routing-mark=to_WAN2 check-gateway=ping

    add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping

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

    but I do not understand why, or where I’m wrong but problems steaming, https web sites
    you can help me solve the problem?
    please

    Like

    Comment by antosere — April 2, 2014 @ 1:53 AM

  160. Hey there. its sam 🙂

    I was looking over one of my 2 WAN PPC on a rb450G (ports 4-5) and i noticed i am using a Bridge for ports 1-3. Should i be using a Master port vs Bridge? Any performance issues i could incur doing this? No idea why i am using a bridge. I think it came out of the box with a bridge on the rb450G vs master/slave. its running 4.14

    Like

    Comment by Sam — April 5, 2014 @ 10:45 AM

  161. how it can possible rb 750 combine two or more network
    i.e 4Mb+4Mb=8Mb.
    how it is posible reply my email
    imran_rasool1991@tahoo.com

    Like

    Comment by imran — April 7, 2014 @ 12:30 AM

  162. Sir i am Babu i wants to easy solution Auto redundancy from mikrotik plz help me..

    Like

    Comment by Babu — April 7, 2014 @ 9:25 AM

  163. Sir i think you have lot of experience in mikrotik so i wants to help auto redundancy script.i am wait for your mail.

    Like

    Comment by Babu — April 9, 2014 @ 10:15 AM

  164. Sorry Sir load balance i am ok but i wants to help auto redundancy script i don’t know redundancy men primary / secondary fail over ? plz help me…..

    Like

    Comment by Babu — April 11, 2014 @ 4:07 PM

  165. Thank Sir i will try it .

    Like

    Comment by Babu — April 12, 2014 @ 4:57 PM

  166. Assalamu walaikum Vaijan,

    I want to know can i pass torrent bandwidth my 2nd wan link?

    Can you please help me.

    Like

    Comment by Salim Rahman — April 15, 2014 @ 9:45 AM

  167. i have 2 isp’s and im using Rb750 …. i want certain traffics to be ruled like facebook,youtube ,DL and others browsing will go only to ISP1 and my ISP2 will be my gaming isp pls help thanks in advance

    Like

    Comment by nhelly — June 1, 2014 @ 9:11 AM

  168. Sir Syed Jahanzaib !
    salam !
    i have two connection of wan one is DSL and the other one is the fiber optic connection. i want to merge both connection to get the double bandwidth and also have to do fail-over can you do it for me via team-viewer, as i am newbie to the mikrotik i need your help please !
    And this will also be a great chance for to learn something 🙂

    Like

    Comment by Ismail khan — June 11, 2014 @ 2:58 PM

  169. Sir
    Salam !
    I am using RB 450 . I have install two ISP in the device and I am using
    PCC method for load balancing. All the Things are running perfectly
    alright. But I am facing problem with the FTP file zilla software. When
    I
    try to upload with the software with active two isp I got the
    disconnection. After that I disable one connection and I tried the File
    ziila software. Its works fine. Can you help me in this matter. How can I
    exempt the IP PCC rules.plz help me .

    Like

    Comment by Babu — July 7, 2014 @ 5:32 PM

  170. hi,i have to links WAN1(10mb up 512k down) and WAN2(1mb up 5mb down),i want to use both links having WAN1 as my download and WAN2 as my upload….how do i configure?? i hace ccr 12g

    Like

    Comment by Jim — July 25, 2014 @ 11:16 PM

  171. correction….hi,i have to links WAN1(10mb down 512k up) and WAN2(1mb down 5mb up),i want to use both links using WAN2 as my main upload….how do i configure?? i hace ccr 12g

    Like

    Comment by Jim — July 25, 2014 @ 11:18 PM

  172. Dear Jahanzaib Sir,
    I have two WAN Links
    WAN1=203.80.130.74, 255.2555.255,252, DGW=203.80.130.73, DNS-203.80.130.1
    WAN2 = DSL Model 10.92.4.2

    please advise me how can configure failover router.
    Regards
    Abdul Wahab
    Sukkur

    Like

    Comment by Abdul Wahab — August 17, 2014 @ 2:48 PM

  173. sir kiya me loadbalancing me wan1 for only downloading and wan2 for browsing me istmal kar skte hain???

    Like

    Comment by naveed ahmad — October 24, 2014 @ 8:48 PM

  174. Hello my friend. Tell me this setup will work in model: Rb951g-2hnd?

    Like

    Comment by sam — November 4, 2014 @ 11:14 AM

  175. wan 1 is blinking but wan2 is not blinking.
    interface main bhi wan2 main koi activity nahi hay please tell me solution.

    Like

    Comment by Adeel iqbal — November 12, 2014 @ 11:04 PM

  176. pls i need Script Integration pcc for 3 line all of them 2 M (2M+2M+2M)

    Like

    Comment by HEMA — December 6, 2014 @ 5:13 AM

  177. can i add pppoe server on same RB using external radius server on public IP ?

    can you make Script pls , i have setup RB for 3 wan and works perfert .

    Like

    Comment by Richard — December 27, 2014 @ 6:43 PM

  178. asssalam alikum
    bhai i have tp link 470t se load balancing ker raha hoon . jab lan ko mikrotik se connect kerta hoon tu hotspot by pass hai

    yani mera client direct internet use ker rahein hain portal page per nahe jata

    koi nat rule jo mera load balancer ko hotspot se on karey

    yani sab client hotspot ke throu jain aur mujeh tp link change na kerna perhey

    nouman
    nouman82 at hotmail dot com

    Like

    Comment by nouman — January 1, 2015 @ 4:20 AM

  179. sir i have 2 internet lines on cable internet having same 1mbps speed all i want is 2mbps output on download speed.i have configured pppoe on both the dsl routers.dhcp is off on both routers.i have configured mikrotik 750 as per the script given below,but i am not getting 2mbps output on download speed.when i download ny file on idm it gives 1mbps speed and check back in mikrotik it shows traffice only on wan1.after disconnecting wan1 manually it shows traffic on wan2.My question is,is my configuration wrong.is it true i will get download speed of 2mpbs after bonding 2 wan connections of 1mbps each in mikrotik.pls guide me through this problem.

    Like

    Comment by sarang — February 4, 2015 @ 8:50 PM

  180. there is bug at established packets WAN to LAN.

    This rulles:
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes

    Solution:
    So apply this rule to marking only new packets/connection from LAN to WAN. Not both.
    I add this “connection-state=new only” to rules.

    Example:
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes connection-state=new
    add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:2/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes connection-state=new

    Its working well now.

    Like

    Comment by Messo — February 12, 2015 @ 7:43 PM

    • This bug causes randomly redirect all packets. So there was problem with response from WAN. Packet has 50% chance to redirect to wrong WAN port.

      Like

      Comment by Messo — February 12, 2015 @ 7:46 PM

    • Good pointer 🙂 thx

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — February 14, 2015 @ 10:45 AM

  181. I want to set limit on each wan that when 300 GB bandwidth completed no more data pass through that wan which completed own 300 gb bandwidth. email: unsajjad@gmail.com

    Like

    Comment by sajjad hussain — March 8, 2015 @ 11:21 PM

  182. Good evening has all I have a dual wan server radius.ho a problem with one of my clients ( pppoe – client – test) asked me to open the doors to the server that has in place and the doors are :
    9000
    9080

    how do I direct the doors to the router that receives the pppoe I I created ?

    Like

    Comment by seri — March 19, 2015 @ 10:21 PM

  183. Hello,
    Thanks for configuration. I process your steps and load balancing work fine, but I can’t ping and connect to router using winbox or www.
    I set DMZ on both routers so I suppose that all traffic are routed to RB750.

    Here is my configuration. I suppose that it should be added some entries to firewall but I don’t have so knowledge.

    /ip pool
    add name=default-dhcp ranges=192.168.88.10-192.168.88.254
    /ip dhcp-server
    add address-pool=default-dhcp disabled=no interface=Local name=default
    /ip address
    add address=192.168.88.1/24 comment=”default configuration” interface=Local network=192.168.88.0
    add address=192.168.1.2/24 interface=WAN1 network=192.168.1.0
    add address=192.168.2.2/24 interface=WAN2 network=192.168.2.0
    /ip dns static
    add address=192.168.88.1 name=router
    /ip firewall filter
    add chain=input dst-port=8291,8728,80 protocol=tcp
    add chain=input comment=”default configuration” protocol=icmp
    add chain=input comment=”default configuration” connection-state=established
    add chain=input comment=”default configuration” connection-state=related
    add action=drop chain=input comment=”default configuration” in-interface=WAN1
    add chain=forward comment=”default configuration” connection-state=established
    add chain=forward comment=”default configuration” connection-state=related
    add action=drop chain=forward comment=”default configuration” connection-state=invalid
    /ip firewall mangle
    add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=WAN1_conn
    add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=WAN2_conn
    add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1
    add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2
    add chain=prerouting dst-address=192.168.1.0/24 in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 in-interface=Local
    add action=mark-connection chain=prerouting comment=WAN1 dst-address-type=!local in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:2/0
    add action=mark-connection chain=prerouting comment=WAN2 dst-address-type=!local in-interface=Local new-connection-mark=WAN2_conn per-connection-classifier=both-addresses-and-ports:2/1
    add action=mark-connection chain=prerouting disabled=yes dst-address-type=!local in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:3/2
    add action=mark-routing chain=prerouting comment=WAN1 connection-mark=WAN1_conn in-interface=Local new-routing-mark=to_WAN1
    add action=mark-routing chain=prerouting comment=WAN2 connection-mark=WAN2_conn in-interface=Local new-routing-mark=to_WAN2
    /ip firewall nat
    add action=masquerade chain=srcnat comment=”default configuration” out-interface=WAN1 to-addresses=0.0.0.0
    add action=masquerade chain=srcnat out-interface=WAN2
    /ip route
    add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1
    add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2
    add check-gateway=ping distance=1 gateway=192.168.1.1
    add check-gateway=ping distance=2 gateway=192.168.2.1

    Thanks in advance
    Cris

    Like

    Comment by Krzysztof — March 30, 2015 @ 2:54 AM

  184. Hello,

    My name is Fernando, I am Brazilian, I do not understand about mikrotik, need help to configure RD 750 GL, two wan, 25 mb and 10 mb and will use LAN1, LAN2 LAN3 in sectoral paines, thank your help, I need scrip.

    Current Status of the connection: 1
    VDSL

    Upstream Speed (kbps): 2600
    Speed Downstream (kbps): 27496
    Local IP address: 192.168.25.1
    Public IP address:
    Default Gateway:
    Primary DNS: 200.175.5.139
    Secondary DNS: 200175182139

    Current Status of the connection: 2
    ADSL

    Upstream Speed (kbps): 1173
    Speed Downstream (kbps): 12799
    Local IP address: 192.168.1.1
    Public IP address:
    Default Gateway:
    Primary DNS: 200.175.5.139
    Secondary DNS: 200175182139

    Thank you for sending the script.

    Manoel Fernando
    55 81 41064477
    mfs91180907@hotmail.com

    Like

    Comment by Manoel Fernando — April 5, 2015 @ 1:59 AM

  185. sir,i want to know how much bandwidth will mk750gl support on dual wan bonding.will it support 20Mbps to 30Mbps bandwidth.

    Also same with mk750.how much bandwidth will this router support.

    Like

    Comment by sarang — April 7, 2015 @ 4:54 PM

    • it will easily support 40-50mb , but other factors also counts, like number of firewall rules, other services , queuing method etc. monitor CPU resources and then add things accordingly. MRTG can help you for historical base monitoring as well 🙂 Good Luck

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — April 11, 2015 @ 3:05 PM

  186. how to make 3wan and 2lan in pcc loadbalancing plz help

    Like

    Comment by nosharwan — April 25, 2015 @ 8:22 AM

  187. buenos dias mi nombre es antonio
    tengo un problema que no se solucionar quiero publicar por dos isp mi propio AS bgp multihoming pero no consigo hacerlo
    gracias

    Like

    Comment by antonio — April 26, 2015 @ 1:25 PM

  188. Hello,
    May name is deepak, i m using mikrotik 750gl router, i want to share 2 wan internet conneciton loadbalancing. so what to do, give me suggestion.for ip firewall.

    Like

    Comment by Deepak Jadhav — April 27, 2015 @ 9:38 PM

  189. Hello,
    Thanks for configuration. I process your steps and load balancing work fine, but I can’t ping and connect to router using winbox or www.
    I set DMZ on both routers so I suppose that all traffic are routed to RB750.
    Here is my configuration. I suppose that it should be added some entries to firewall but I don’t have so knowledge.
    /ip pool
    add name=default-dhcp ranges=192.168.88.10-192.168.88.254
    /ip dhcp-server
    add address-pool=default-dhcp disabled=no interface=Local name=default
    /ip address
    add address=192.168.88.1/24 comment=”default configuration” interface=Local network=192.168.88.0
    add address=192.168.1.2/24 interface=WAN1 network=192.168.1.0
    add address=192.168.2.2/24 interface=WAN2 network=192.168.2.0
    /ip dns static
    add address=192.168.88.1 name=router
    /ip firewall filter
    add chain=input dst-port=8291,8728,80 protocol=tcp
    add chain=input comment=”default configuration” protocol=icmp
    add chain=input comment=”default configuration” connection-state=established
    add chain=input comment=”default configuration” connection-state=related
    add action=drop chain=input comment=”default configuration” in-interface=WAN1
    add chain=forward comment=”default configuration” connection-state=established
    add chain=forward comment=”default configuration” connection-state=related
    add action=drop chain=forward comment=”default configuration” connection-state=invalid
    /ip firewall mangle
    add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=WAN1_conn
    add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=WAN2_conn
    add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1
    add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2
    add chain=prerouting dst-address=192.168.1.0/24 in-interface=Local
    add chain=prerouting dst-address=192.168.2.0/24 in-interface=Local
    add action=mark-connection chain=prerouting comment=WAN1 dst-address-type=!local in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:2/0
    add action=mark-connection chain=prerouting comment=WAN2 dst-address-type=!local in-interface=Local new-connection-mark=WAN2_conn per-connection-classifier=both-addresses-and-ports:2/1
    add action=mark-connection chain=prerouting disabled=yes dst-address-type=!local in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:3/2
    add action=mark-routing chain=prerouting comment=WAN1 connection-mark=WAN1_conn in-interface=Local new-routing-mark=to_WAN1
    add action=mark-routing chain=prerouting comment=WAN2 connection-mark=WAN2_conn in-interface=Local new-routing-mark=to_WAN2
    /ip firewall nat
    add action=masquerade chain=srcnat comment=”default configuration” out-interface=WAN1 to-addresses=0.0.0.0
    add action=masquerade chain=srcnat out-interface=WAN2
    /ip route
    add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1
    add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2
    add check-gateway=ping distance=1 gateway=192.168.1.1
    add check-gateway=ping distance=2 gateway=192.168.2.1
    Thanks in advance
    Cris

    —————————————————————————————————————————
    hello cris,

    as per configuration for mikrotik routing. it’s working fine. and my question your both internet working simantancly working. and

    Like

    Comment by Deepak Jadhav — April 27, 2015 @ 10:12 PM

  190. if i load balance 2 wan and what happend when one of them are down? it will work like fail over or total network will down? plz ans

    Like

    Comment by Shahadat Hossain Aarif — May 20, 2015 @ 9:15 PM

  191. i want to use 2 microtik servers on same network to devide network so plz tell me main points plz

    Like

    Comment by Haroon — June 15, 2015 @ 4:36 PM

  192. i have a 2 wan setup with rb750gl. i want 2 specific computers (ip) to only access 1 wan only. e.x pc1 to wan1 and pc2 to wan2 only. i dont mind the rest of the pc’s in the network .

    i added

    /ip firewall address-list
    add address=192.168.1.10 list=stat-WAN1
    add address=192.168.1.20 list=stat-WAN2

    /ip firewall mangle
    add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=WAN1_conn
    add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=WAN2_conn
    add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1
    add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2
    add chain=prerouting dst-address=192.168.0.0/24 in-interface=LAN
    add chain=prerouting dst-address=192.168.10.0/24 in-interface=LAN
    add action=mark-connection chain=prerouting dst-address-type=!local in-interface=LAN new-connection-mark=WAN1_conn \
    per-connection-classifier=both-addresses-and-ports:2/0
    add action=mark-connection chain=prerouting dst-address-type=!local in-interface=LAN new-connection-mark=WAN2_conn \
    per-connection-classifier=both-addresses-and-ports:2/1
    add action=mark-routing chain=prerouting connection-mark=WAN1_conn in-interface=LAN new-routing-mark=to_WAN1
    add action=mark-routing chain=prerouting connection-mark=WAN2_conn in-interface=LAN new-routing-mark=to_WAN2
    add action=mark-routing chain=prerouting dst-address-type=!local in-interface=LAN new-routing-mark=to_WAN1 src-address-list=\
    stat-WAN1
    add action=mark-routing chain=prerouting dst-address-type=!local in-interface=LAN new-routing-mark=to_WAN2 src-address-list=\
    stat-WAN2

    and although it works (using speedtest)

    i see WAN2_conn established in the firewall/connections tab for 192.168.1.10 and WAN1_conn for 192.168.1.20

    is there a solution to this?

    Like

    Comment by nikkarad — July 5, 2015 @ 6:32 PM

    • Dear sir,
      I have created a unequal load balancing where wan1 (2mb) and wan 2 (10 mb) .I created rule for wan2 as priority but when all user try to browsing then which site goes through wan1 get way they get poor browsing speed .what can i do now?

      Like

      Comment by sohag — August 3, 2015 @ 4:17 PM

  193. Greetings!! best blog ever, im new in the MIKROTIK world, i cant find this guide for dynamic ISP!!!, i really trying so hard to find the way dual wan ppc fail over with dynamic isp and port Forwarding!!!, please can you help me?

    Like

    Comment by Rafael Segnini — August 12, 2015 @ 4:26 AM

  194. […] Mikrotik DUAL WAN Load Balancing using PCC method. Complete Script ! by zaiB – Script ของผมใช้จากที่นี่เป็นหลัก […]

    Like

    Pingback by ทำ Load Balancing โดยใช้ Router Mikrotik | Learning Inventions Laboratory — August 18, 2015 @ 7:08 PM

  195. ye scrpt sahi hai

    /ip address
    add address=192.168.1.3/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1 comment=”” disabled=no
    add address=192.168.2.3/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2 comment=”” disabled=no
    add address=10.10.0.1/24 network=10.10.0.0 broadcast=10.10.0.255 interface=internal comment=”” disabled=no

    /ip firewall mangle
    add chain=prerouting in-interface=internal connection-state=new nth=2,1 action=mark-connection new-connection-mark=conn1 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=internal connection-mark=conn1 action=mark-routing new-routing-mark=conn1 passthrough=no comment=”” disabled=no
    add chain=prerouting in-interface=internal connection-state=new nth=1,1 action=mark-connection new-connection-mark=conn2 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=internal connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment=”” disabled=no

    /ip firewall nat
    add chain=srcnat connection-mark=conn1 action=masquerade out-interface=WAN1 comment=”” disabled=no
    add chain=srcnat connection-mark=conn2 action=masquerade out-interface=WAN2 comment=”” disabled=no

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.1.1 scope=255 target-scope=10 routing-mark=conn1 comment=”” disabled=no
    add dst-address=0.0.0.0/0 gateway=192.168.2.1 scope=255 target-scope=10 routing-mark=conn2 comment=”” disabled=no

    Like

    Comment by sahir — August 30, 2015 @ 9:58 PM

  196. ??????

    Like

    Comment by sahir — August 30, 2015 @ 10:11 PM

  197. Hello I have two ADSL connections named wan1 and WAN2 ,
    how do I send traffic p2p and torrent only in WAN2

    Like

    Comment by serena — September 25, 2015 @ 6:47 PM

  198. I need help for the following scenario:
    ISP1-PTCL Modem: 192.168.11.1/24 (16Mb)
    ISP2-Local-ISP: 203.124.xxx.xxx/29 (1Mb)
    LAN: 10.0.0.1/24
    LAN: 192.168.0.100/24

    Requirement is to Load balance/Fail over/ISP2 Static IP forward to my DVR.
    If ISP2 Fails, DVR down forwarding must be stop.
    Both Internet must be use on LAN.

    DVR1 IP: 192.168.0.254
    DVR2 IP: 192.168.0.253
    DVR3 IP: 192.168.0.252

    Plz give me solution.

    Like

    Comment by Irfan K. — November 18, 2015 @ 1:11 AM

    • simple create port forwarding rule in mikrotik for required interface and dst-nat to dvr. but in pcc you have to make additional rules in order to make port forwarding work properly. search ‘aacable pcc port forward’

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — November 18, 2015 @ 8:38 AM

  199. i can’t access on youtube after loadbalance everything else works fine, i guess. but i when i try you tube it says ” Surf Safely!!

    This website is not accessible.

    The site you are trying to access contains content that is prohibited for viewership from within Pakistan.

    help pls. thank you.

    Like

    Comment by john — November 21, 2015 @ 12:40 AM

    • Change the DNS to 8.8.8.8
      YT is banned in Pakistan, and dns used in this script is pointing to Pakistani isp dns and they r blocking YT.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — November 21, 2015 @ 9:03 AM

  200. Dear Friends,

    i am trying with Mikrotik DUAL WAN Load Balancing using PCC methodSo is my um bale request to all please give me solution of that with both addresses and ports as the classifier.but sum it will break certain things like banking web sites and some forums.So is my um bale request to all plz give me solution

    Like

    Comment by bharat patel — December 22, 2015 @ 10:26 AM

  201. I Have RB750 and i want to try it as a Load Balancer,
    i have 2 wan
    one fibre link
    IP is : 192.168.1.2
    Gateway : IP is 192.168.1.1
    and 2nd Wan is Connect ADSL
    which iP is
    192.168.0.100
    and Gateway is 10.100.154.19
    Please reply me how to connect both wan to the RB750 and Get a one LAN Out put. for my Network

    Thanks

    Atif Adeel Nizami
    03 4 5 – 2 6 4 3 3 8 8
    atif_adeel@yahoo.com
    skype
    atif_adee;

    Like

    Comment by Atif Adeel — January 5, 2016 @ 2:57 PM

    • first configure both wan links in mikrotik and make sure both are working.
      then you ahve multiple options to make load balacning.
      example you can setup PCC base load balancing so mikrotik will auto manage the management of load balancing.
      OR
      You can do the policy base routing and make user ip groups of your choice and route them to selected gateway of your choice.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — January 14, 2016 @ 12:15 PM

  202. I have configured 2 WAN Load Balancing using the NTH Method as I want double bandwidth. My internet is working fine but I am having issues with my DVR, how can I redirect my traffic to WAN 1 only for my cameras so that it can run smoothly? I have only 1 LAN and my DVRs are getting the ip addresses using DHCP server from 192.168.200.1/24 network same as the desktop user clients who are on the same network. Below is my configuration:

    /ip address
    add address=192.168.200.1/24 network=192.168.200.0 broadcast=192.168.200.255 interface=LAN comment=”” disabled=no
    add address=192.168.43.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1 comment=”” disabled=no
    add address=192.168.44.2/24 network=192.168.44.0 broadcast=192.168.44.255 interface=WAN2 comment=”” disabled=no

    /ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.8.8,8.8.4.4

    /ip firewall mangle
    add chain=prerouting in-interface=LAN connection-state=new nth=2,1 action=mark-connection new-connection-mark=conn1 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=LAN connection-mark=conn1 action=mark-routing new-routing-mark=conn1 passthrough=no comment=”” disabled=no
    add chain=prerouting in-interface=LAN connection-state=new nth=1,1 action=mark-connection new-connection-mark=conn2 passthrough=yes comment=”” disabled=no
    add chain=prerouting in-interface=LAN connection-mark=conn2 action=mark-routing new-routing-mark=conn2 passthrough=no comment=”” disabled=no

    /ip firewall nat
    add chain=srcnat connection-mark=conn1 action=masquerade out-interface=WAN1 comment=”” disabled=no
    add chain=srcnat connection-mark=conn2 action=masquerade out-interface=WAN2 comment=”” disabled=no

    /ip route
    add dst-address=0.0.0.0/0 gateway=192.168.43.1 scope=255 target-scope=10 routing-mark=conn1 comment=”” disabled=no
    add dst-address=0.0.0.0/0 gateway=192.168.44.1 scope=255 target-scope=10 routing-mark=conn2 comment=”” disabled=no

    Like

    Comment by Akbar Shah — January 17, 2016 @ 2:12 PM

  203. Asalam o Alaiqum. how r u janab?
    i have searched your blog. but didnt found any configuration regarding Dynamic DHCP of ISPs on WAN ports. above are about Static IPs of WAN. but if any ISP provide its Dynamic IPs then how can anybody config it on both Dual ports for WAN on MIkrotik RB750 with one LAN. furthermore what will be the scenario.

    Looking forward for its solution, kindly provide.. JazakALLAH…

    Like

    Comment by a1technoman — January 31, 2016 @ 10:53 AM

    • my apologize.. forgot to mention.. please provide it with particular head (load balancing dual WAN with QoS, failover (ISPs are dynamic DHCP)). So, when anyone can search about such topic so they will get relevant link of your blog.. Thankyou..

      Like

      Comment by a1technoman — January 31, 2016 @ 10:57 AM

  204. dear,
    i want to learn mikrotik initaily can provide me how to learn it in lahore

    Like

    Comment by ta;ha — February 29, 2016 @ 1:27 AM

  205. sir mera swala waheen reh gaya
    kis tarha hum 3 ISP
    Connect PPTP
    Fariya PPTP
    Dream PPOP

    ek hi UTP main chala saktain hain yani area ka network wala serif IP change karta hai or apka net Connect say Fariya or Fariya say Dream main convert hojata hai

    Like

    Comment by hammad — April 18, 2016 @ 12:25 AM

  206. It wont work for me, my second wan appears as inactive in routes list and theres no traffic in wan2 interface. I’ve used your script as you wrote it.
    If i invert the distances in routes list, the opposite happens, wan1 stops working and shows as inactive and all traffic goes through wan2.
    Im sory for my bad english, im from Argentina.

    Like

    Comment by Gianmarco Cafferata — April 25, 2016 @ 6:53 PM

  207. You are amamzing!!!
    We followed it line by line, just editing it for our needs, thank you soooooooo much! 🙂

    Like

    Comment by Jamal Smith-Graham — June 22, 2016 @ 11:15 PM

  208. hi i have
    2pppoe wan dhcp
    one wlan wan dhcp
    one lan 192.168.88.1
    how to lLoad Balancing & fail over setup

    Like

    Comment by Abdulsamad — August 5, 2016 @ 2:52 PM

  209. I just bought a RB951G but i am not sure how to run this script since the router already has some default configuration.

    Should i remove all default config first ?
    How do i access the router then ?

    Like

    Comment by BB — August 21, 2016 @ 2:56 AM

    • First try to understand what script is really about, how it works.
      Reset it to factory default, and dont keep old config. then use this script.
      make sure you change the interface name according to the script.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — August 24, 2016 @ 10:37 AM

  210. Hi, How can I use this script for dual wan, same isp, bandwidth and subnet. Help me plz . Regards

    Like

    Comment by Reyner Aguero — September 3, 2016 @ 9:01 AM

  211. it’s working fine with hotspot users …. but it’s not with pppoe clients ?? how we can make it work with both hotspot + pppoe clients ??
    when i use pppoe user with defult speed ( 32mb ) it’s work on one line
    please how we can solve this issue ???

    Like

    Comment by qassam — September 9, 2016 @ 11:58 PM

    • you have to adjust the natting rules to accommodate both.
      plus you need addition auth rule for hotspot to work with the LB. Search Mikrotik wiki or forums , or this blog. In rote about it already.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — September 18, 2016 @ 4:02 PM

      • It works for me.. But how to save the graph of all the pppoe clients using the tools graphing in mikrotik. .The graphs is working fine but when I reboot the my mikrotik router RB750GL the graph has lost.

        Like

        Comment by Frederick — October 25, 2016 @ 2:56 AM

  212. dear brother email problem how we solve ip change ho jata hai ak gatway ho tu nahi problem

    Like

    Comment by usmanjutt — November 20, 2016 @ 5:44 PM

  213. Hey there, i’m having some problems with mikrotik. Amm, i have a wan connection of 4mb now there is some problem with that connection so its slow down so i decided to merge another wan connection. i know some networking principles but newbie in mikrotik i watch videos of load-balancing. So when i merge two wan it works perfectly and hotspot runs fine but pppoe doesn’t get internet access.
    Note: I first have set hotspot and pppoe for 1 wan, and it works perfectly.
    WAN 1: 192.168.98.2 | 4 mb
    WAN 2: 192.168.97.2 | 2mb
    LAN : 172.16.1.1/24 with hotspot
    PPPOE: 172.16.3.1/24

    #my code

    ip>firewall>mangle
    chain: prerouting, in interface: ether5, connection state: new
    nth: every:2, packet:1, action mark connection, new connection mark:conn_1, pass throught: check

    chain: prerouting, in interface: ether5, connection mark: conn_1, action: mark routing, new routing mark: conn_1, passthrough: uncheck

    chain: prerouting, in interface ether 5, connection state: new, nth: every:1, packet:1, action: mark connection, new connection mark: conn_2, passthrought: check

    chain: prerouting, in interface: ether5, connection mark: conn_2, action: mark routing, new routing mark: conn_2, passthrough: uncheck

    ip>firewall>nat
    chain:srcnet, out interface: ether1, connection mark: conn_1, action: masquerade

    chain:srcnet, out interface: ether2, routing mark: conn_2, action: masquerade

    ip>firewall>routes
    gateway: 192.168.98.1, distance: 1, scope:255, target scope:10, routing mark:conn_1

    gateway: 192.168.97.1, distance: 2, scope:255, target scope:10, routing mark:conn_2

    now i have another mikrotik router so i decided to load balance on another router and hotspot and pppoe on other router. so i remove load balancing from one mikrotik to another
    mikrotik1 with load balancing ip: 192.168.99.1
    mikrotik2 with pppoe & hotspot ip: 192.168.99.2

    now pppoe load balancing is working some how good and hotspot is also working fine but pppoe don’t work properly it connects and give internet access for 10 seconds the no internet access and can’t access mikrotik (i have to disable internet adapter in network setting then re-enable it then i see mikrotik ip in neighbours)

    #What i want?
    I want to load balance 2 wan now but it will be unequal because wan1/ether2/192.168.97.1 is going to be 2 mb from 20 january (currently both wan has 4 mb) and i want to run pppoe, hotspot and load balancing on one mikrotik.

    Like

    Comment by Muhammad Arsalan Siddiqui — January 11, 2017 @ 10:07 PM

  214. Hello Sir,
    I using your loadbalancing, its working fine with provided source code.

    i have two lines, 1st is 12Mb and Second is 38Mb.

    now problem is 1st line of 12Mb is unlimited and second is limited like cap of 500GB,

    now i want that all network first utilize 1st Connection of 12Mb , then if needed more Internet then add extra Mb from second connection of 38Mb.

    like if all network using 10Mb then it only use 1st connection of 12Mb and if all network using 16Mb speed then 1st connection use all speed of 12Mb and remaining 4Mb from second connection of 38Mb.

    Like

    Comment by hammad hassan — January 13, 2017 @ 7:54 PM

  215. […] Mikrotik DUAL WAN Load Balancing using PCC method. Complete Script ! by zaiB – Script ของผมใช้จากที่นี่เป็นหลัก […]

    Like

    Pingback by ทำ Load Balancing โดยใช้ Router MikroTik | Wuttikrai Wattaso — March 22, 2017 @ 10:02 AM

  216. Hi, zaib

    I used pcc loadbalanci 3 wan using your mehod, It Work awesome ad perfectly, but I have some problem here, when I want to force my dhcp client to used my dns server my mikrotik, but when I used dst nat to redir to port 53 , my client cant browsing.

    this is my nat rule :

    ip firewall nat print
    Flags: X – disabled, I – invalid, D – dynamic
    0 ;;; nat-loadbalance
    chain=srcnat action=masquerade out-interface=1___pppoe-out1 log=no
    log-prefix=””

    1 chain=srcnat action=masquerade out-interface=2__eth2-indihome-10mb log=no
    log-prefix=””

    2 chain=srcnat action=masquerade out-interface=3__eth6-astinet log=no
    log-prefix=””

    3 chain=dstnat action=redirect to-ports=53 protocol=tcp dst-port=53 log=no
    log-prefix=””

    4 chain=dstnat action=redirect to-ports=53 protocol=udp dst-port=53 log=no
    log-prefix=””

    Do you have any idea to solve my problem?

    Thanks for your help……

    Best Regard….

    Like

    Comment by angga — May 17, 2017 @ 1:17 AM

  217. […] Mikrotik DUAL WAN Load Balancing using PCC method. Complete Script ! by zaiB […]

    Like

    Pingback by DUAL WAN Load Balancing using PCC method | emek — June 14, 2017 @ 3:33 PM

  218. Syed Zaib, You are a real herro. I think you eat mikrotik completely! every where that i haven’t any solution, find something wonderful in your blog. I think you are one of the MVPs in the world of-course. maybe you have just this simple blog but your scripts are so famous in all over the internet. thanks for sharing us and thanks for your efforts.

    Like

    Comment by Ali Fanaei — June 28, 2017 @ 12:12 PM

    • JazkaAllah for your kind wordings, i m just an student who is trying to learn from mistakes/failures attempts & share my knowledge for all who wants to learn.

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — June 29, 2017 @ 3:32 PM

  219. Dear Syed, I implemented it. it works fine completely but there is some issue, i was wondering if you could address me how we can solve the issue too. The first thing about hotspot. unfortunately it seems it didn’t work when using hotspot in you lan interface. but the other thing that is much important is true fail-over. I saw that using recursive route (mikrotik advance routing) the route table adopt completely and change as the time of link failure. Mikrotik also switch it well but the client that connected to lan interface seems have not so smooth connection. in fact if you try to ping a valid host continually (like “ping 4.2.2.4 -t”) from both client and also from mikrotik itself, you will see that as the time one link failure, the mikrotik switch to health wan link automatically but in client it doesn’t. all the ping reply show “request timed out”. but as the time as you interup the continus ping (ctrl+c) and ping 4.2.2.4 again, you will see it works! actually it seems there is need to user action. and for new connection it works but how about the persist connection? maybe they are so important too. also hot fail over may not show at this way. i was wondering if you can help about it too (sorry for my unsuitable English writing)

    Like

    Comment by Ali Fanaei — June 30, 2017 @ 11:37 PM

    • you can make a simpe script that checks for failed links, & upon changing routes it may drop previous established connections to they may reconnect with new route

      Like

      Comment by Syed Jahanzaib / Pinochio~:) — July 4, 2017 @ 2:08 PM

  220. What to do, if in case of 2 different Static IP address and gateway having different VLAN?

    Like

    Comment by Dharm Raj Joshi — July 16, 2017 @ 9:41 PM

  221. Hello Sir!

    I have 2 satellite modems, both have the same IP address from the same provider! My question is: is it possible to use the same IP address and the same gateway for WAN1 & WAN2?

    And about the hotspot rule, should I move it to the top of the nat tab?

    Regards

    Like

    Comment by Saleh Zwai — July 18, 2017 @ 1:46 PM

  222. Load benlecing router model No In Microtik

    Like

    Comment by Surajit Sau — September 10, 2017 @ 10:09 PM

  223. both address in PCC drops voip connections

    Like

    Comment by pippo — October 29, 2017 @ 2:14 PM

  224. Hi i am using RB750GL and i have set PCC load balancing on 2 links and also set failover everything is working fine but i am facing one issue when i unplug my PTCL modem cable from router i get disconnect from internet but get continuously reply from my gateway in other hand if my ISP get disconnect from his ISP in this cause i’m also getting response from my gateway but i cannot connect with the internet what sort of failover setup should i use so i get to know that the problem is in my internal network or external.
    please guide me.

    Like

    Comment by Ahmed — November 13, 2017 @ 5:43 PM

  225. hi can you please tell me how many ips i get in this ip range 172.26.136.128/25

    Like

    Comment by Pain — January 20, 2018 @ 5:15 AM

  226. Access control point training

    Mikrotik DUAL WAN Load Balancing using PCC method ! by zaiB | Syed Jahanzaib Personal Blog to Share Knowledge !

    Like

    Trackback by aluminum fences — May 12, 2018 @ 10:09 PM

  227. I have to ISP and I want to use ISP1 = online games, ISP2 = Browsing. How to separate it? Thank you in advance

    Like

    Comment by vindox09 — July 9, 2018 @ 7:33 PM

  228. […] : https://aacable.wordpress.com Load Balance menggunakan PCC ( per-connection-classifier)dengan both addresses and ports sebagai […]

    Like

    Pingback by NTH load balancing with masquerade – Blog Wong Ndeso — October 9, 2018 @ 7:36 AM

  229. sory yar ak sacript chahye jis ka ip loacl ka outpot 192.168.1.1 ho or wan ka 192.168.12.1 2 wan ka192.168.13.1 ho

    Like

    Comment by Rashid ALi — October 19, 2018 @ 2:55 PM

  230. Sir I want to merge 2 wan links 50mb each.and need throughput of 100mb

    Like

    Comment by Sarang — December 6, 2018 @ 8:50 PM

  231. can u help me how to do it, separate browsing and gaming using 2 wan, a 10mbps wan 1 ip 192.168.254.254, and 5mbps wan2 192.168.1.1, network ip 192.168.88.2-192.168.88.20 for 18 pc

    Like

    Comment by Sergio B. Goco Jr. — May 5, 2019 @ 3:37 PM

  232. i had done load balancing using your method but i am having issue in voice and video call (whatsapp, zoom etc) kindly help me out

    Like

    Comment by chparas — July 6, 2020 @ 4:31 PM


RSS feed for comments on this post. TrackBack URI

Leave a comment