This week the forum was quiet, so we bring you a hands-on guide to configuring mwan3 multi-WAN load balancing on OpenWrt 23.05 with SpacemiT K1, covering policy design, traffic steering, and failover testing on dual-RGMII architectures.
In industrial gateways, IoT edge nodes, and rural broadband deployments, a single WAN uplink is a single point of failure. Multi-WAN with mwan3 lets you:
The SpacemiT K1 - an 8-core X60 RISC-V SoC at 1.6 GHz delivering 50K DMIPS - runs OpenWrt 23.05 natively and is an excellent platform for multi-WAN gateways thanks to its dual RGMII MAC interfaces.
LAN: bridged via CPU port or a third VLAN segment
This physical isolation means each WAN path has its own ARP table, DHCP lease, and MAC address - essential for carrier-grade failover.On a fresh OpenWrt 23.05 build for K1, install the mwan3 packages:
opkg update opkg install mwan3 luci-app-mwan3After installation, restart the network:
/etc/init.d/network restart /etc/init.d/mwan3 enable /etc/init.d/mwan3 startEdit /etc/config/network to define two WAN interfaces. Both use DHCP in this example, but one could be PPPoE:
config interface 'wan' option proto 'dhcp' option device 'eth0' option metric '10' config interface 'wanb' option proto 'dhcp' option device 'eth1' option metric '20' The metric field is critical - it sets the default route priority. Without distinct metrics, the kernel will not install both default routes, and mwan3 cannot function.Verify both routes exist:
ip route show defaultYou should see two default routes with different metrics:
default via 192.168.1.1 dev eth0 metric 10 default via 192.168.2.1 dev eth1 metric 20A 1:2 weight ratio means roughly one-third of new connections go through WAN, two-thirds through WANb. Adjust based on your link bandwidth.
Rules map traffic to policies. Here are common patterns:
config rule 'default_rule' option dest_ip '0.0.0.0/0' option use_policy 'balanced' config rule 'voip_rule' option proto 'udp' option dest_port '5060,5061,10000-20000' option use_policy 'wan_only' config rule 'dns_rule' option proto 'udp' option dest_port '53' option use_policy 'wanb_only' The default_rule catches all unmatched traffic and load-balances it. VoIP (SIP/RTP) is pinned to WAN1 for stability, while DNS goes through WANb to distribute resolver load.Rules are evaluated top-to-bottom - order matters.
mwan3 tracks each WAN link by pinging a target IP. Configure tracking in each interface section:
config interface 'wan' option track_ip '8.8.8.8' option track_method 'ping' option reliability '1' option count '1' option timeout '2' option interval '5' option down '3' option up '3' Key parameters:After applying configuration, verify mwan3 status:
mwan3 status You should see both interfaces as online and the balanced policy active. To test failover:To check per-connection routing:
mwan3 status | grep -A5 "current policy" conntrack -L | head -20The conntrack table shows which WAN each connection uses. New connections after a failover immediately use the surviving link.
If you have custom firewall rules, check for compatibility:
nft list ruleset | grep mwan You should see mwan3-generated chains in the mangle table. The old iptables-nft compatibility layer still works for simple rules, but native nftables is recommended for production. For traffic shaping combined with mwan3, use tc (the traffic control utility, included in OpenWrt 23.05): tc qdisc add dev eth0 root cake bandwidth 50Mbit tc qdisc add dev eth1 root cake bandwidth 80MbitThis caps each WAN at its real throughput and prevents bufferbloat from skewing mwan3 load-distribution decisions.
| Problem | Likely Cause | Fix |
|---|---|---|
| Only one default route | Same metric on both WAN | Set distinct metrics (10, 20) |
| Traffic only on one WAN | Missing member in policy | Add both members to balanced policy |
| Failover too slow | High down/up thresholds | Reduce down to 1-2, interval to 3s |
| mwan3 not starting | Interface names mismatch | Ensure mwan3 interface names match network config |
| Sticky sessions not working | conntrack not loaded | opkg install conntrack, enable conntrackd |
| No nft rules | Old mwan3 version | opkg upgrade mwan3 to >= 2.11 |
The K1 8-core X60 design handles multi-WAN traffic with minimal CPU overhead. In our tests:
The K1 also supports 2 TOPS of AI inference - enough to run lightweight anomaly detection on WAN traffic patterns alongside mwan3, opening possibilities for intelligent link selection based on latency, jitter, and packet loss trends.
This guide was demonstrated on the following platforms available through Open RISC-V:
We will continue covering practical RISC-V and OpenWrt topics. Upcoming areas of interest: