Routing traffic from Docker container on OpenWrt host trough separate (virtual)WAN interface

Hi, i have a Lynksys WRT32x running OpenWrt 22.03.2

I have a few customizations made, auto mount scripts for usb/esata devices, samba, extroot, installed docker-ce and i have containers up and running, but for the last 2 weeks i've been trying(succesfully) to create a virtual wan port, that gives me a second ip from my isp using a (MAC VLAN) from the wan port, what i cant do is make every container that i run to access the web trough the virtual wan, and every computer on the network trough the real Wan interface.

Before this i have never messed arround with Vlans, and bridges and most of the things i should understand to get this up and running, i have been reading about it, trying and testing, but i cant do it. I have tryed to create a vlan and putting the virtual wan and the docker interfaces on a separate vlan, and somehow when i went to from my computer it reported the ip address of the virtual interface, and nothing related to the lan was on that vlan. That got me confused... i also managed to lock my self locked out of the router (while messing with VLAN's), and that makes trial and error time consuming...

I really dont know how to get there. I am no stranger to config files and scripting, but i am not posting any of that because most of my trial and error on the subject was done using the web interface, so i will post a pic with what i've done.

I'm not asking anyone to do the hard work for me, but tell me if there is something wrong with what i've done so far, and point me in the right direction plz...


Let me start by saying I'd need to do some experimenting myself, but I have a few ideas. Have you checked out the docs for mwan3?

It's by no means the exact answer to the question you're asking but it covers a lot of the basics for having multiple WAN links, using different metrics, for example. I suspect having multiple WAN interfaces online with the same metric is what caused all LAN traffic to route out your VIRTUAL_WAN interface.

That's not to say mwan3 isn't the answer to your question, I'm guessing this problem can be solved multiple ways. Once configured you can configure mwan3 to route specific source IP address (bridged Docker image, for example) to a specific WAN interface. Hope this helps!

Nope, i have installed it but the configuration is not done trough the web interface, all i remember about it is some priority to route traffic, but i think that was intended to load balance and/or fail safe when you have real dual wan. I havent done any experiments with it because its all about config files, wich i am no stranger to, but to change them directly you really need to know what you are doing, and i really dont.

But i'll check the docs.

I suggest also installing the package luci-app-mwan3! Configuration is done under Network -> MultiWAN Manager.

I don't believe I hand touched a single config file thus far. I am routing traffic between a local ADSL connection and Starlink at the moment, but I don't see why you couldn't use it to select traffic between two IPs on the same provider using the Rule section.

I suggest also installing the package luci-app-mwan3! Configuration is done under Network -> MultiWAN Manager.

Tryed that, but i coudnt make it work...

Are both interfaces showing as up in the MultiWAN Manager - Overview page?

Did you add anything to the MultiWAN Manager - Rules page?

They do, because they are already pre configured, listed as wan and wanb, the simplest solution i found was renaming my virtual interface to wanb, and that did the trick. But i paused this, maybe indefenetly... I ran into other problems. I dont know why, but ocasional, after a few days, or weeks, my extroot just gives up. I need it because my device doesnt have the space to install docker and required dependencies, but if it keeps crashing, and resetting to defaults its no use to me. Thx for your help.