Redundant Internet connections on consumer hardware with OpenWrt and Mwan3
Uplink 1
The first uplink uses the router's WAN port. It makes sense to combine the WAN port with the faster uplink of the available lines. Plug one end of the RJ45 cable into the cable modem and the other end into the WAN port of the AC1750 on the other. The DSL connection delivers 65 MBit/s downstream and 20 MBit/s upstream; the coaxial cable connection is more powerful at 500/50 and thus the standard connection.
It may be necessary to restart the cable modem after connecting to the AC1750. Using Luci, log into OpenWrt and configure the LAN
port for DHCP
. OpenWrt automatically enables IPv6 in parallel if a genuine dual stack is available from the Internet provider.
If everything works out, the WAN connection will have an IPv4 and an IPv6 address at the end of the process. In preparation for the dual WAN setup, it makes sense to click on Edit
for the WAN interface in Luci and to type 10
in the Router Metric
box. OpenWrt needs this metric later to prioritize the uplinks.
Uplink 2
Uplink 2 is a bit trickier, because OpenWrt doesn't have a port for it yet. To correct this problem, click on Network | Switch
in Luci to display the configuration of the built-in switch.
In the case of the AC1750, two VLANs are configured, with ports 1 to 4 on VLAN 0 and the WAN
port on VLAN 1. After pressing Add
, you can add a VLAN 3. Then ensure that the port named Port 3
is only untagged on VLAN 3
; for all other VLANs, however, the value in the table must be off
. Finally, click on Save & Apply
.
The other half of the configuration for uplink 2 consists of defining an interface in OpenWrt that uses the new VLAN. If you connect port 4 of the Archer C7 to your other uplink – such as the DSL modem, an Ethernet connection is established. But PPPoE is still missing for logging in on the provider side and thus establishing the connection.
Select Network | Interfaces
. Add New Interface
calls the required dialog. In Protocol of the new interface
, select PPPoE or another suitable protocol. When it comes to selecting the interface, eth0.3
is the right choice for the VLAN 3 you just created. You have now created a logical connection between the VLAN and a PPPoE connection on the router. The name for the interface is WAN2
(Figure 3).
![](/var/linux_magazin/storage/images/issues/2019/222/openwrt-with-mwan3/figure-3/746506-1-eng-US/Figure-3_large.png)
Next, select Network | Interfaces
and choose WAN2
Edit
in the interface. In the following dialog, define the PPPoE connection parameters. Important: A routing metric must also be defined for WAN2
, say, 20
in this example.
After you save the settings, OpenWrt establishes the connection automatically.
Setting Up Mwan3
Now that the connections are configured, the next step is to configure Mwan3 to switch between the two active connections. All in all, this arrangement works very well for IPv4, but IPv6 can cause complications (see the box entitled "Trouble with IPv6").
Trouble with IPv6
Mwan3 uses NAT and Iptables rules to implement load balancing. For IPv4, this approach works very well, but if you use Mwan3 with IPv6, it is less effective.
The main reason Mwan3 doesn't work well with IPv6 is because it uses NAT. IPv6 has a totally different way of defining private local networks, and the support for IPv6 in Mwan3 appears to have problems with address assignment using the RADVD protocol, which is a kind of like DHCP for IPv6.
To configure Mwan3 on OpenWrt, log into your router and run the opkg update
command, which updates the OpenWrt package lists. Then run opkg install luci-app-mwan3
, which installs both the GUI part of Mwan3 and the main Mwan3 application.
Once Mwan3 is set up, you can check its status and configuration via the web interface (Figure 4). Most admins, however, prefer editing the configuration file.
The /etc/config/mwan3
file is the center for Mwan3 configuration. See the OpenWrt website [5] for more on editing the Mwan3 configuration file. The first block in the file specifies the source address for packets generated on the router. This section is followed by four definitions for the interfaces present in the system: two for IPv4 and two for IPv6. Using the list track_ip
directive, the admin can determine which hosts Mwan3 ping
s to find out whether the line is online or offline. The other values are default parameters and can be adopted without changes.
The member
paragraphs in the Mwan3 configuration assign metric values and weights to the NICs. However, these entries only become meaningful in the context of the following policy definitions. You need these policies to bundle several interfaces and the associated metrics and weights to create a complete package.
At the bottom are the rule
paragraphs, which define concrete rules for certain types of traffic from certain sources or with certain destinations. The https
rule in the example specifies that the same connection must always be used for HTTPS connections. sticky
specifies that connections must not switch between interfaces.
See the Mwan3 documentation for more on configuring Mwan3 settings.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
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](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.