Basic support for multiple WANs (netifd & default gateway)
Bjørn Mork
bjorn at mork.no
Sat Sep 3 05:54:42 PDT 2022
Rafał Miłecki <zajec5 at gmail.com> writes:
> Sounds good. I'm aware of plain metric-based solution. Users with more
> requirements should just use mwan3.
There's a third alternative which IMHO is extremely useful with
active-active multi-wan solutions:
The 'ip4table' and 'ip6table' interface options.
Put all routes associated with each WAN interface into separate tables.
The actual outgoing interface can then be selected based on ip rules,
allowing not only destination and fallback policies, but also source
(address or interface) based rules
The advantage is that you can have clients selecting WAN interface by
choosing the appropriate source address. Or you can have separate WiFi
networks associated with each WAN link. Etc.
This is pretty standard Linux policy routing. But OpenWrt makes it
extremely easy to configure. Just add 'ip4table' and 'ip6table' to the
WAN interfaces and as complex rules as you want pointing to those
tables:
https://openwrt.org/docs/guide-user/network/routing/ip_rules
This also makes it a lot easier to handle incoming traffic on both WAN
links, as it allows you to route the return traffic based on the source
address.
Bjørn
More information about the openwrt-devel
mailing list