Close Menu
IcyFlame StudioIcyFlame Studio
  • Categories
    • Internet
    • SEO
    • Tools
    • Tutorials
  • Networking
  • Routers
  • Updates
  • Speed Test
Facebook X (Twitter) Instagram
IcyFlame StudioIcyFlame Studio
  • Categories
    • Internet
    • SEO
    • Tools
    • Tutorials
  • Networking
  • Routers
  • Updates
  • Speed Test
IcyFlame StudioIcyFlame Studio
Home»Networking»Mikrotik Load Balancing Script: 2WAN, 3WAN, 4WAN
Networking

Mikrotik Load Balancing Script: 2WAN, 3WAN, 4WAN

IcyFlame StudioBy IcyFlame StudioUpdated:25/03/2024
Share Facebook Twitter Pinterest Telegram WhatsApp
Mikrotik Load Balancing

Mikrotik Load balancing helps you combine two or more internet sources and provides you with combined bandwidth from all sources.

That means You can Combine the Internet of two or more ISPs and get high-speed Internet. For eg. 150Mbps + 150Mbps = 300Mbps Internet

Also Read: Mikrotik Port Forwarding

Related: Mikrotik RB5009

load balancing setup
Mikrotik Load Balancing Setup

Table of Contents

  • Mikrotik Load Balancing
  • Mikrotik Loadbalancing Tutorial
  • Mikrotik Load Balancing Script
  • Load Balancing Script Download
    • Load Balancing 2 Wan Script
    • Load Balancing 3 Wan Script
    • Load Balancing 4 Wan Script
    • FAQ

Mikrotik Load Balancing

By the method of Network Load Balancing, You can Combine two or more WAN Gateway in one and can utilize combined bandwidth from both WAN Links.

In Mikrotik Routers you can configure Load Balancing and merge two or more UP Links together to Reduce your Network Load.

Mikrotik Loadbalancing Tutorial

Make sure to watch the complete tutorial video, which explains how you can use the provided scrips and Correctly configure Load Balancing in your Mikrotik Router.

Mikrotik Load Balancing Tutorial With Speed Test

Mikrotik Load Balancing Script

Here you can download scripts for Mikrotik 2 Wan Load Balancing, Mikrotik 3 Wan LoadBalancing, and Mikrotik 4 Wan LoadBalancing.

Using the scrips in Mikrotik makes it easier to Configure Mikrotik Routers.

Load Balancing Script Download

You can download Mikrotik Load Balancing Scripts and use the scripts to configure your Mikrotik Router to Load Balance and achieve High-Speed Internet by combining multiple internet sources.

Load Balancing 2 Wan Script

You can configure Load Balancing for 2 Wan using the following script.

  • Download Link – Visit Now
  • Mirror Link – Visit Now
/interface ethernet
set [ find default-name=ether5 ] name=LAN
set [ find default-name=ether1 ] name=WAN1
set [ find default-name=ether2 ] name=WAN2
set [ find default-name=ether3 ] disabled=yes
set [ find default-name=ether4 ] disabled=yes

/ip hotspot profile
add dns-name=abhsek.com hotspot-address=192.168.0.1 name=hsprof1

/ip pool
add name=hs-pool-5 ranges=192.168.0.2-192.168.0.254

/ip dhcp-server
add address-pool=hs-pool-5 disabled=no interface=LAN lease-time=23h59m59s \
    name=dhcp1

/ip hotspot
add address-pool=hs-pool-5 interface=LAN name=hotspot1 profile=hsprof1

/ip address
add address=192.168.0.1/24 interface=LAN network=192.168.0.0
add address=192.168.1.4/24 interface=WAN1 network=192.168.1.0
add address=192.168.2.4/24 interface=WAN2 network=192.168.2.0

/ip dhcp-server network
add address=192.168.0.0/24 comment="hotspot network" gateway=192.168.0.1

/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4

/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes

/ip firewall mangle
add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=\
    WAN1_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=\
    WAN2_conn passthrough=yes
add action=mark-routing chain=output connection-mark=WAN1_conn \
    new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_conn \
    new-routing-mark=to_WAN2 passthrough=yes
add action=accept chain=prerouting dst-address=192.168.1.0/24 in-interface=\
    LAN
add action=accept chain=prerouting dst-address=192.168.2.0/24 in-interface=\
    LAN
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN1_conn passthrough=yes \
    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 passthrough=yes \
    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 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_conn \
    in-interface=LAN new-routing-mark=to_WAN2 passthrough=yes

/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
    src-address=192.168.0.0/24

/ip hotspot user
add name=admin password=admin

/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.1.1 scope=255
add check-gateway=ping distance=2 gateway=192.168.2.1 scope=255

Load Balancing 3 Wan Script

To configure Load Balancing for 3 Wan, Please use the following Script.

  • Mirror Link – Visit Now
  • Mirror Link – Visit Now
/interface ethernet
set [ find default-name=ether5 ] name=LAN
set [ find default-name=ether1 ] name=WAN1
set [ find default-name=ether2 ] name=WAN2
set [ find default-name=ether3 ] name=WAN3
set [ find default-name=ether4 ] disabled=yes

/ip hotspot profile
add dns-name=abhsek.com hotspot-address=192.168.0.1 name=hsprof1

/ip pool
add name=hs-pool-5 ranges=192.168.0.2-192.168.0.254

/ip dhcp-server
add address-pool=hs-pool-5 disabled=no interface=LAN lease-time=23h59m59s \
    name=dhcp1

/ip hotspot
add address-pool=hs-pool-5 interface=LAN name=hotspot1 profile=hsprof1

/ip address
add address=192.168.0.1/24 interface=LAN network=192.168.0.0
add address=192.168.1.4/24 interface=WAN1 network=192.168.1.0
add address=192.168.2.4/24 interface=WAN2 network=192.168.2.0
add address=192.168.3.4/24 interface=WAN3 network=192.168.3.0

/ip dhcp-server network
add address=192.168.0.0/24 comment="hotspot network" gateway=192.168.0.1

/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4

/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes

/ip firewall mangle
add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=\
    WAN1_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=\
    WAN2_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN3 new-connection-mark=\
    WAN3_conn passthrough=yes
add action=mark-routing chain=output connection-mark=WAN1_conn \
    new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_conn \
    new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN3_conn \
    new-routing-mark=to_WAN3 passthrough=yes
add action=accept chain=prerouting dst-address=192.168.1.0/24 in-interface=\
    LAN
add action=accept chain=prerouting dst-address=192.168.2.0/24 in-interface=\
    LAN
add action=accept chain=prerouting dst-address=192.168.3.0/24 in-interface=\
    LAN
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN1_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:3/0
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN2_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:3/1
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN3_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:3/2
add action=mark-routing chain=prerouting connection-mark=WAN1_conn \
    in-interface=LAN new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_conn \
    in-interface=LAN new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN3_conn \
    in-interface=LAN new-routing-mark=to_WAN3 passthrough=yes

/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2
add action=masquerade chain=srcnat out-interface=WAN3
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
    src-address=192.168.0.0/24

/ip hotspot user
add name=admin password=admin

/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.3.1 routing-mark=to_WAN3 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.1.1 scope=255
add check-gateway=ping distance=2 gateway=192.168.2.1 scope=255
add check-gateway=ping distance=3 gateway=192.168.3.1 scope=255

Load Balancing 4 Wan Script

Please use the following link to configure Load Balancing for 4 WAN Links.

  • Mirror Link – Visit Now
  • Mirror Link – Visit Now
/interface ethernet
set [ find default-name=ether5 ] name=LAN
set [ find default-name=ether1 ] name=WAN1
set [ find default-name=ether2 ] name=WAN2
set [ find default-name=ether3 ] name=WAN3
set [ find default-name=ether4 ] name=WAN4

/ip hotspot profile
add dns-name=abhsek.com hotspot-address=192.168.0.1 name=hsprof1

/ip pool
add name=hs-pool-5 ranges=192.168.0.2-192.168.0.254

/ip dhcp-server
add address-pool=hs-pool-5 disabled=no interface=LAN lease-time=23h59m59s \
    name=dhcp1

/ip hotspot
add address-pool=hs-pool-5 interface=LAN name=hotspot1 profile=hsprof1

/ip address
add address=192.168.0.1/24 interface=LAN network=192.168.0.0
add address=192.168.1.4/24 interface=WAN1 network=192.168.1.0
add address=192.168.2.4/24 interface=WAN2 network=192.168.2.0
add address=192.168.3.4/24 interface=WAN3 network=192.168.3.0
add address=192.168.4.4/24 interface=WAN3 network=192.168.4.0

/ip dhcp-server network
add address=192.168.0.0/24 comment="hotspot network" gateway=192.168.0.1

/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4

/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes

/ip firewall mangle
add action=mark-connection chain=input in-interface=WAN1 new-connection-mark=\
    WAN1_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN2 new-connection-mark=\
    WAN2_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN3 new-connection-mark=\
    WAN3_conn passthrough=yes
add action=mark-connection chain=input in-interface=WAN4 new-connection-mark=\
    WAN4_conn passthrough=yes
add action=mark-routing chain=output connection-mark=WAN1_conn \
    new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_conn \
    new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN3_conn \
    new-routing-mark=to_WAN3 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN4_conn \
    new-routing-mark=to_WAN4 passthrough=yes
add action=accept chain=prerouting dst-address=192.168.1.0/24 in-interface=\
    LAN
add action=accept chain=prerouting dst-address=192.168.2.0/24 in-interface=\
    LAN
add action=accept chain=prerouting dst-address=192.168.3.0/24 in-interface=\
    LAN
add action=accept chain=prerouting dst-address=192.168.4.0/24 in-interface=\
    LAN
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN1_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/0
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN2_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/1
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN3_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/2
add action=mark-connection chain=prerouting dst-address-type=!local \
    in-interface=LAN new-connection-mark=WAN4_conn passthrough=yes \
    per-connection-classifier=both-addresses-and-ports:4/3
add action=mark-routing chain=prerouting connection-mark=WAN1_conn \
    in-interface=LAN new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_conn \
    in-interface=LAN new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN3_conn \
    in-interface=LAN new-routing-mark=to_WAN3 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN4_conn \
    in-interface=LAN new-routing-mark=to_WAN4 passthrough=yes

/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2
add action=masquerade chain=srcnat out-interface=WAN3
add action=masquerade chain=srcnat out-interface=WAN4
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
    src-address=192.168.0.0/24

/ip hotspot user
add name=admin password=admin

/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.3.1 routing-mark=to_WAN3 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.4.1 routing-mark=to_WAN4 \
    scope=255
add check-gateway=ping distance=1 gateway=192.168.1.1 scope=255
add check-gateway=ping distance=2 gateway=192.168.2.1 scope=255
add check-gateway=ping distance=3 gateway=192.168.3.1 scope=255
add check-gateway=ping distance=4 gateway=192.168.4.1 scope=255

If you have any Queries regarding Mikrotik Load Balancing, Then Please Comment below!

FAQ

Can MikroTik do load balancing?

Yes, MikroTik routers can be configured to perform load balancing by combining multiple WAN Links to achieve higher speed, failover, and Load Balancing.

What is dual WAN load balancing?

Dual WAN Loadbalancing is the method of combining two WAN Links to increase the overall Bandwidth.

Share. Facebook Twitter Pinterest Telegram WhatsApp
Previous ArticleVianet Fiber Router Setup | Onu Configurations | Vianet Modem
Next Article Ubiquiti UniFi AP AC LR | Dual Band Long Range Access Point
IcyFlame Studio
  • Website
  • Facebook

Your Destination For All Technology Needs !!

Related Posts

8.5
Networking

IgniteNet Spark AC Wave2 Mini PoE Wireless Access Point | SP-W2M-AC1200-POE

8.7
Networking

Ubiquiti UniFi US-16-150W POE Switch | UniFi Switch 16 PoE

9.3
Routers

Mikrotik RB5009UG+S+IN | The Ultimate Home Lab Router

View 5 Comments

5 Comments

  1. Rai Villegas on 05/06/2021 4:34 PM

    Hi! I have hex MT which has a hotspot and bandwidth management configurations. I want to add a dual wan config, will this affect any of my current configs?

    Reply
    • IcyFlame Studio on 05/06/2021 4:41 PM

      No, It won’t affect your current configure, just configure the script according to your network needs.

      Reply
  2. Philip je on 20/08/2021 12:11 AM

    hi sir,
    is cellular bonding of 4 wan is possible in Mikrotik.?
    is it ok to connect dongle to TP LINK Portable 3G/4G router and convert to WAN 1 ,2 ,3 ,4?

    Reply
  3. Harlen Morais Naves on 25/11/2021 1:12 AM

    HI,

    I’ve added LB with 2 connections but when both are enabled the internet speed drops to Kbps that makes almost impossible to browser or even to resolve DNS.
    I have the main link with 500Mbps/250Mbps and the backup link with 500Mbps/35Mbps.
    What could be the problem?

    Reply
  4. chester on 29/11/2021 6:26 PM

    How can get my total speed 800mbps + 80 mbps backup
    it s only 84mbps, i get on speedtest

    Reply
Leave A Reply Cancel Reply

Latest Posts
8.5

IgniteNet Spark AC Wave2 Mini PoE Wireless Access Point | SP-W2M-AC1200-POE

8.0

UniFi Mobile Router (UMR) | Ubiquiti LTE Router 5G

8.7

Ubiquiti UniFi US-16-150W POE Switch | UniFi Switch 16 PoE

9.3

Mikrotik RB5009UG+S+IN | The Ultimate Home Lab Router

Google Adsense now showing Anchor ads on AMP Sites with Auto Ads

Stay In Touch
  • Facebook
  • YouTube 30.2K
Important Links
  • About us
  • Blog
  • Contact us
Useful Links
  • Nepali Date Converter
  • Recommendations
  • Web Stories
Affiliate Disclosure

When you purchase through links on our site, we may earn an affiliate commission. Learn more

Copyright © 2025 IcyFlame Studio - All Rights Reserved !!
  • Affiliate Disclosure
  • Cookie Policy
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

Type above and press Enter to search. Press Esc to cancel.