Jul 13, 2016 · 4 min read

Multi-WAN manages your traffic over multiple WAN interfaces, routes individual sessions over the least busy WAN interface and that session continues to use the same WAN until terminated.

This guide assumes that you already have your interfaces and other settings configured correctly, as it will only cover the Multi-WAN specific setup steps.

SSH to your LEDE/OpenWRT device

If you are using Windows then start PuTTY and click Session on the left side, select SSH from the options, and then enter in the IP Address of your LEDE/OpenWRT box into the Host Name field.

Once you’ve done this just click on Open to start up the SSH connection.


If you are connecting via terminal, then just SSH to your device using the following command, where is your device’s IP address.

ssh root@

Installing Packages

First up we need to download the multiwan package that is going to help us configure this.

Run the following commands:

opkg update
opkg install multiwan

Now we need to enable multiwan, so run the following commands:

/etc/init.d/multiwan enable
/etc/init.d/multiwan start
/etc/init.d/multiwan single


Now we need to make some changes to the multiwan configuration, so run the following to edit it’s config file:

vi /etc/config/multiwan

Change/add the following to the configuration:

config 'multiwan' 'config'
option 'default_route' 'balancer'

Once this is done, restart the multiwan process by running the following:

/etc/init.d/multiwan restart

WAN Interfaces

Now edit the same config file again and change/add the following lines, making sure to tweak to your specific needs:

config 'interface' 'wan'
option 'weight' '10'
option 'health_interval' '10'
option 'icmp_hosts' 'dns'
option 'timeout' '3'
option 'health_fail_retries' '3'
option 'health_recovery_retries' '5'
option 'failover_to' 'wan2'
option 'dns' 'auto'
config 'interface' 'wan2'
option 'weight' '10'
option 'health_interval' '10'
option 'icmp_hosts' 'dns'
option 'timeout' '3'
option 'health_fail_retries' '3'
option 'health_recovery_retries' '5'
option 'failover_to' 'balancer'
option 'dns' 'auto'

Once again, restart the multiwan process by running the following once you are done:

/etc/init.d/multiwan restart

Outbound Rules

For setting outbound traffic rules you will need to change/add the follow to the same config file, changing the variables as you need:

config 'mwanfw'
option 'src' ''
option 'proto' 'udp'
option 'ports' '21'
option 'wanrule' 'wan'

Then again, restart the multiwan process by running the following once you are done:

/etc/init.d/multiwan restart

Multiwan Setup

The next steps will outline creating your multiwan setup.

Create VLAN

First off we need to define a vlan for WAN2, so run the following command:

vconfig add eth0 2

Configure VLANs and Network Interfaces

Run the following command to open the network config file:

vi /etc/config/network

We need to move LAN port 0 from default eth0_0 to eth0_2, and Configure WAN and WAN2 proto as dhcp.

Multiwan’s documentation provides us with the following example network config setup to follow.

Please note that port numbers can vary between device, so double check what they are for your specific device.

# The following assumes a six port switch, the default WAN port is switch port 0, 
# the default LAN ports (1-4) are switch ports (1-4) and the internal switch port
# connection to the router mainboard is switch port 5.

# Although a common configuration, some routers are configured with a 5 port switch,
# a separate physical network interface for the WAN port and the numbering system
# may be different.
config 'switch' 'eth0'
option 'enable' '1'
# Note: The internal switch port 5 is tagged "5t" in the following configuration
# to allow it to be shared by multiple VLANs (eth0.0., eth0.1, eth0.2)
# Configure 3 external LAN ports on VLAN0.
config 'switch_vlan' 'eth0_0'
option 'device' 'eth0'
option 'vlan' '0'
option 'ports' '2 3 4 5t'
# Configure default WAN port on VLAN1.
config 'switch_vlan' 'eth0_1'
option 'device' 'eth0'
option 'vlan' '1'
option 'ports' '1 5t'
# Configure WAN2 port on VLAN2.
config 'switch_vlan' 'eth0_2'
option 'device' 'eth0'
option 'vlan' '2'
option 'ports' '0 5t'
# Default loopback interface.
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' ''
option 'netmask' ''
# Default 'lan' interface configured with Spanning Tree Protocol activated.
config 'interface' 'lan'
option 'type' 'bridge'
# On some routers the default 'lan' interface is configured directly
# to the physical network interface eth0. This has to be changed to
# a VLAN, in this case eth0.0
option 'ifname' 'eth0.0'
option 'proto' 'static'
option 'stp' '1'
option 'ipaddr' ''
option 'netmask' ''
# wan interface
config 'interface' 'wan'
option 'ifname' 'eth0.1'
option 'proto' 'dhcp'
option 'dns' ''
# wan2 interface
config 'interface' 'wan2'
option 'ifname' 'eth0.2'
option 'proto' 'dhcp'
option 'dns' ''

Configure WAN & Multiwan

Once that is complete, we can now configure WAN and Multiwan to work together. The easiest way to do this is via the LuCi interface.

For the WAN setup we need to do the following:

Head into Network > Interfaces > WAN/WAN2 and add WAN2 to the WAN firewall zone.

For Multiwan, we need to carry out these steps:

Head into Network > Multiwan and tweak the following:

  • You can remove any unused WAN interfaces here
  • Set load balancer distribution to your desired levels
  • Set failover to LoadBalancer

Save all of your changes and give your device one last reboot.

Everything should be configured now, so give your device a test to make sure everything is working.

If you found this post helpful please let us know by clicking the ♥ below.

This blog was brought to you by Cucumber Wi-Fi. Cucumber helps you run a more efficient Wi-Fi network. Check it out here.

Cucumber Wi-Fi — control any (Wi-Fi) device from the cloud.

LEDE/OpenWrt & IoT

Tutorials based on LEDE/OpenWrt from CT WiFi

    CT WiFi

    Written by

    CT WiFi

    An orchestration tool for WiFi devices — Manage your networks from a single-pane of glass.

    LEDE/OpenWrt & IoT

    Tutorials based on LEDE/OpenWrt from CT WiFi

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade