Redundant Internet connections on consumer hardware with OpenWrt and Mwan3

Double Track

© Lead Image © sermax55, 123RF.com

© Lead Image © sermax55, 123RF.com

Article from Issue 222/2019
Author(s):

Redundant Internet uplinks are standard on big corporate networks, but they are still the exception for the home and small-office sector. If you're ready to experiment, you can set up redundant Internet connections on your own home router with OpenWrt and the powerful Mwan3 extension.

A router with two Internet connections provides many advantages, including better network performance and continued operation if one link fails. Redundant Internet connections have long been standard for data centers and enterprise networks, but they are relatively rare in homes and small offices.

One reason for the absence of redundant connections on small networks is cost, but even when cost is not an issue, home users and small-time admins are often intimidated by the technical issues of supporting two Internet connections through the same inexpensive router.

The ever-resourceful open source universe, however, does provide an inexpensive solution for running redundant Internet connections through an inexpensive home router. The solution begins with OpenWrt, a Linux distribution designed to run on routers and other embedded devices. If you are adventurous enough to install OpenWrt on your router device, you will discover you have much more control over the device than you ever had with the standard router firmware interface. In particular, the Mwan3 extension available for OpenWrt provides support for redundant connections. Mwan3 dynamically manages access via two or more uplinks, uses Ping to ensure that the links are working and, when necessary, adds NAT support and dynamic IPtables rules.

This article describes how to set up a redundant connection using OpenWrt [1] and Mwan3. Of course, if you try this configuration yourself, you'll need to subscribe to multiple Internet connections. OpenWrt supports DSL and PPPoE out the box; if you want to use LTE, the easiest way is through an OpenWrt-supported USB modem. OpenWrt can manage most legacy devices without any problems.

What Hardware?

At least as important as choosing the appropriate Internet access method is choosing the hardware. With OpenWrt as a router, no other router is allowed to block the line. If you already have DSL or a cable gateway, it is best to check the manual to see whether the device supports bridge mode. Bridge mode means that the router demotes itself to a simple modem and passes the incoming network signal on to another device – in this case, the OpenWrt-based router.

Many routers offer a bridge mode, but the way the user activates it differs. With cable providers, you can usually enable bridge mode via a web interface in the customer center. With DSL, you might find the option in the router's configuration interface.

If you have multiple working Internet connections and equip them with physical modems or routers downgraded to modems, you still have to worry about finding the right hardware for an OpenWrt router device (see box entitled "Hardware with More Power"). Although OpenWrt runs on a large number of recent devices, the quality of the OpenWrt implementation differs greatly for different devices.

Hardware with More Power

Support for Qualcomm hardware in OpenWrt is not perfect – in the majority of cases, users won't notice it, but a little background information is helpful in case you run into problems.

Modern network chipsets for LAN and WLAN come with a variety of special functions that enable performance gains. One such optimization feature is offloading, in which the device's network chip assumes tasks that would otherwise place load on the host CPU. Transferring functions such as packet filtering or connection tracking to the network chip can bring a significant performance boost.

The problem is that even well-supported Qualcomm drivers don't support every offloading function.

Snapshot versions of OpenWrt offer access to a generic offloading feature of the Linux kernel, but this feature was unstable during operation. The last stable OpenWrt version achieved 240 MBit/s in our lab – but it then reached the end of its tether and all purported tuning measures failed.

If you want to use OpenWrt and multiple uplink configurations behind high bandwidth connections – as described in this article – you might want to check out Omnia Turris [2], from the Czech domain administrators NIC.CZ (Figure 1). Omnia Turris is an OpenWrt-based router on open source hardware. The router achieves the promised GBit/s performance in the downstream without any problems. You can use Mwan3 with Omnia Turris, but the OpenWrt fork that Omnia maintains is prehistoric – it is based on OpenWrt 15.05, which was released in 2015.

Figure 1: The open-hardware Omnia Turris from NIC.CZ saturates a GBit link without any problems.

Mwan3 is also very old, and some tips and configuration files described in this article cannot be used on an Omnia Turris, but the Omnia Turris solution is usually acceptable in small office environments. The Omnia Turris forum offers instructions for configuring Mwan3 with multiple WANs [3]. @KE

The compatibility of the router device is also related to the manufacturers of the chipsets that are used in SOHO routers. On one hand is Qualcomm, with its Atheros series, which is one of the better-supported chips on Linux. On the other hand is industry leader Broadcom, with its various model ranges. Broadcom's Linux support varies in quality.

The OpenWrt developers recommend the Qualcomm variant, which is sometimes difficult to find. Devices by the usual suspects (Asus, Netgear, Linksys) typically use Broadcom chips. TP-Link routers rely on Qualcomm. The example described in this article will use the TP-Link AC1750 router (also known as the Archer C7), which has a street price of around EUR 90 (Figure 2).

Figure 2: Devices such as the TP-Link AC1750 are well suited as home routers for multiple uplinks.

If you prefer to search for other devices, you don't necessarily have to look for devices with multiple WAN ports. This is because the WAN ports are usually connected to the same switches in the device as all other ports. It is therefore easy to convert one of the existing switch ports to a second WAN port at a later date.

Prepare Setup

The example described in this article assumes a redundant Internet uplink consisting of a DSL connection and a cable connection. Many revisions of the TP-Link AC1750 (Archer C7) router are available on the market. OpenWrt supports them all, but you need an OpenWrt image that matches the revision. It is worth visiting the Table of Hardware on the OpenWrt Wiki [4] to discover the details of the firmware image. If you are trying this procedure on a different device, the steps will be different – consult the manual for your own router.

You'll need an up-to-date version of OpenWrt to follow this article. How OpenWrt is installed on your router depends on the hardware. In the case of the Archer C7, the device must first be connected to a computer or an existing network using an RJ45 cable.

To install the firmware, set up the computer to run a TFTP server that is accessible on the IP address 192.168.0.66. The folder offered via TFTP must contain the factory image of OpenWrt 18.06.1 for the Archer C7v4; the file should be named ArcherC7v4_tp_recovery.bin.

Then turn off the AC1750 with the power button, hold down the reset button with a pointed object, switch the power button on again, and hold down the reset button for about 4 seconds. The LEDs on the device flicker briefly, then the OpenWrt image is downloaded via TFTP. Please note: The reset gives you factory settings on the device; if you previously configured a different IP address or special passwords, you will have to configure these customized settings again.

If your personal computer is on the same network as the AC1750, reboot, and you will receive an IP address from DHCP that will allow you to log in via SSH or the web interface without a password. The IP address for the router is 192.168.0.1. If you log in via the web interface, Luci forces the admin to set the password immediately so that an SSH login is no longer possible.

Configuration

Once you have installed OpenWrt on your router device, the next step is the basic configuration. A large part of the configuration is the network settings. If you want a special DHCP configuration or a static IP address assigned to DHCP clients, enter the desired options in the Luci web interface under Network | DHCP & DNS. You can also use Luci to set up any special DNS forwarding servers. The OpenWrt router still does not have an Internet connection. The following sections describe how to set up the Internet uplink connections.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Tuning WLAN Routers

    Learn how to take control of your home routing device with OpenWrt.

  • Free Software Projects

    OpenWRT puts Linux on WLAN routers and helps users set up large-scale WLANs at home, and the FreeWRT derivative adds a professional touch. If you don’t have your own compile farm, the OpenSUSE build service may be just what you need. And we investigate the obstacles to new packages for Debian.

  • Gargoyle: Web Interface for Router Configuration

    The Gargoyle project is working on an alternative web interface for better router configuration. The project has now reached its first stable version 1.0.

  • Repurposed Router Projects

    If you have an old router lying around, you can put it to good use with a few easy projects and learn something along the way.

  • SSH Reverse Tunnels

    We’ll show you a practical project for monitoring home energy usage with SSH and OpenWrt.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News