Increase Internet speed by load-balancing two WAN connections with WR740N and OpenWRT - Milan Kragujević
Increase Internet speed by load-balancing two WAN connections with WR740N and OpenWRT

Increase Internet speed by load-balancing two WAN connections with WR740N and OpenWRT

Update for 2020: You can now actually bond two WAN connections, to achieve aggregate speed even on a single TCP connection! Read more here ➡ OpenMPTCProuter: True Bonding of 2 WAN connections for cheap! 🎉

If you have two slower Internet connections, for example DSL and WISP, and want to join them together, this tutorial is for you! Using a cheap router, OpenWRT and some skills and time, you can convert your ordinary router into a load balancing and auto-failover routing machine! Pretty cool!

We will be using the software called mwan3 as well as iptables to load balance the two connections.

Note: I’m using OpenWRT and LEDE project interchangeably here, because they’re the same project basically, and are merging currently, but I am using version 17.01.4, which is called LEDE and not OpenWRT.


  1. TP-Link WR740N
  2. Linux machine (can be a VM)
  3. Two WAN internet connections

In my case, I have a DSL connection that’s about 20 Mbps down and 2 Mbps up (realistically 18/1.8 Mbps because I have IPTV and also because of DSL overhead), and a Wireless connection which is 10 Mbps down and 2 Mbps up.

The final result, is 30/4 Mbps connection, which is a perfect increase of speed and is exactly what I expected. See for yourself:

Speedtest Result

We will be using the WAN (blue) port as the “output”, or LAN, and LAN 1 and LAN 2 as the “input”, or WAN. LAN 3 and LAN 4 will be disabled.

The router’s IP will be

Step 1: Prepare your modems

You need to go into the settings of both of your modems/routers (in my case it’s a ZTE ZXHN H267N, and Ubiquity LiteBeam M5 for the WISP connection) and change their IP addresses so that the faster modem has the IP and the slower one has the IP If they’re the same speed, pick one and give it the IP and the other one gets the IP.

Reboot them, make sure DHCP is turned on, and connect to each one using a network cable and verify that the IP they give your computer is in the right subnet (192.168.1.XXX for first, 192.168.2.XXX for second).

Step 2: Build your own OpenWRT image

Because the router we will be using is very cheap and of poor specifications, it only has 4 MB of Flash memory. This is barely enough for OpenWRT with LuCI (the WebUI) and doesn’t leave enough space for us to install other software.

On a freshly installed Ubuntu 17.10 amd64, you need to perform these steps to build the image. Please note, you will need to wait quite a while for it to download and compile and then build the final binary update.

Please do not skip this step and use a prebuilt image, as it will not work!

  1. Install dependencies for building the image
sudo apt -y install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext libssl-dev
  1. Download the ImageBuilder archive
cd ~
mkdir openwrt && cd openwrt
tar -xaf lede-imagebuilder-17.01.4-ar71xx-generic.Linux-x86_64.tar.xz
cd lede-imagebuilder-17.01.4-ar71xx-generic.Linux-x86_64
  1. Build the image for tl-wr740n-v5 (note: replace v5 with the version of your router, i.e. TL-WR740N v4.27 should be tl-wr740n-v4)
make image PROFILE=tl-wr740n-v5 PACKAGES="-ppp -ppp-mod-pppoe -libiwinfo-lua -liblua -libubus-lua -libuci-lua -lua -luci -luci-app-firewall -luci-base -luci-lib-ip -luci-lib-nixio -luci-mod-admin-full -luci-proto-ipv6 -luci-proto-ppp -luci-theme-bootstrap -uhttpd -uhttpd-mod-ubus"
  1. Image has been built. The .bin firmware file we need is located in bin/ar71xx/, and the filename is, presumably, lede-17.01.4-ar71xx-generic-tl-wr740n-v5-squashfs-factory.bin.

Step 3: Flash OpenWRT to your router

I am not going to dwell on this step for too much, as it’s incredibly easy to do. Place the lede-17.01.4-ar71xx-generic-tl-wr740n-v5-squashfs-factory.bin image in a folder, reset the WR740N router to factory settings by holding the Reset/WPS button for a few seconds until all lights blink, connect to it via a network cable in port LAN1, open, enter credentials admin/admin and go to System Tools on the left, then Firmware Upgrade, click the Select File button, select the firmware, making sure it has factory in the name, and click Upgrade.

After the upgrade, reset it to factory settings again, then reboot it (turn it off, wait a few seconds, then turn it on). The lights you see should be Power, System (cog) and LAN 1. If you have anything other than LAN 1 plugged in, unplug it now.

Step 4: Configure OpenWRT

  1. Plug in the cable to the second router (with IP into the WAN (blue) port and wait until you get Internet access.
  2. Using any terminal client (on Windows you can use PuTTY or KiTTY, which is a fork of PuTTY), connect as user root with no password to You should see the LEDE banner and a shell saying [email protected]:~#.
  3. Run the following commands in order:
opkg update
opkg install nano
opkg install mwan3
  1. Wait for the router to reboot. The reason we reboot it is because opkg uses RAM to store the packages, and since we’re not going to be using it anymore, there’s no need to store the packages data in RAM anymore, given that we have very little.
  2. When it’s back, run this cd /etc/config
  3. Download this file and open it in some kind of text editor on your computer
  4. Delete mwan3 with rm /etc/config/mwan3
  5. Open mwan3 for editing with nano /etc/config/mwan3
  6. On your computer, copy the whole file you downloaded and then paste it into nano on the router.
  7. Save the file and exit (by pressing Control+X, then Y then Enter)
  8. Download this file and open it in a text editor
  9. Delete network with rm /etc/config/network
  10. Open network for editing with nano /etc/config/network
  11. Copy the contents of the file and paste them into nano
  12. Save the file and exit
  13. Download this file and open it in a text editor
  14. Delete firewall with rm /etc/config/firewall
  15. Open firewall for editing with nano /etc/config/firewall
  16. Copy the contents of the file into nano
  17. Save and exit
  18. Reboot the router with reboot

Check the results

Using this handy page I created, that just outputs your IP address,, you can see that with every refresh your IP will change, meaning that the connection is being balanced between two interfaces, wan and wan2.

Note: For ease of administration, I’d recommend you put another router after the WR740N if you are not comfortable administering your home network over the console interface, since the router can’t run mwan3 and also the LuCI web interface.

That’s all, thanks for reading this tutorial, I hope you have managed to double your Internet connection :)

If you want to learn more about why and how this works, and how to tweak the configuration, you can check out the links below:

P.S. The OpenWRT/LEDE mapping of switch ports on the WR740N is wrong, and the map they provide as a fix is wrong too. The correct map is shown below:

Port 4 on router maps to Port 1 in LEDE
Port 3 on router maps to Port 4 in LEDE
Port 2 on router maps to Port 3 in LEDE
Port 1 on router maps to Port 2 in LEDE


Scroll to top