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.
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:
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 192.168.20.1.
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
192.168.1.1 and the slower one has the IP
192.168.2.1. If they’re the same speed, pick one and give it the
192.168.1.1 IP and the other one gets the
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).
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!
sudo apt -y install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext libssl-dev
cd ~ mkdir openwrt && cd openwrt wget https://downloads.openwrt.org/releases/17.01.4/targets/ar71xx/generic/lede-imagebuilder-17.01.4-ar71xx-generic.Linuxjv86_64.tar.xz 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
tl-wr740n-v5(note: replace v5 with the version of your router, i.e. TL-WR740N v4.27 should be
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"
bin/ar71xx/, and the filename is, presumably,
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
http://192.168.0.1/, 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.
192.168.2.1) into the WAN (blue) port and wait until you get Internet access.
rootwith no password to
192.168.1.1. You should see the LEDE banner and a shell saying
opkg update opkg install nano opkg install mwan3 reboot
opkguses 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.
mwan3for editing with
nanoon the router.
networkfor editing with
firewallfor editing with
Using this handy page I created, that just outputs your IP address, https://projects.milankragujevic.com/ip.php, you can see that with every refresh your IP will change, meaning that the connection is being balanced between two interfaces,
**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