Create a virtual interface over TOR to achieve policy routing for ".onion" domains through MWAN3

Hello everyone,

I am looking for ways to create a virtual interface in openwrt which will forward all traffic sent to it through TOR.
Goal is to use mwan3 to policy route ".onion" traffic to the particular tun based virtual interface where it will forward traffic through onion network.

I hope i am clear in the requirement.

I have spend 3 days going through what I found and found no way to expose tor as a virtual interface.

Any help or a nudge at the right direction is apriciated.

Have you considering an alternative approach such as using something like Privoxy.

You can configure Privoxy to match on *.onion as a socks4a proxy and route through Tor accordingly. You wouldn't need mwan3 in this case.

No, My primary setup needs Policy routing. Its an essential part here. Adding Privoxy messed up MWAN3 in my testing.

My network depends on policy routing to balance and secure the load across multiple ISP connection (upto 5) and 3 VPN tunnels.

Looking for a way to intergrate tor to mwan3.

You wouldn't have to remove mwan3, but I'm not sure you are going to be able to use mwan3 to route TOR traffic as it's not really designed for it. You could implement a proxy within your mwan3 setup that's designed to handle any .onion requests i.e. Privoxy or something else, but I'm pretty sure some form of proxy may be needed between the client and TOR, if you are not running TOR on the client itself.

I have done this with Privoxy, to make it work across all clients on a LAN I had to implement Proxy Autoconfiguration/WPAD so .onion requests were sent to Privoxy which had a forward-socks4a for TOR traffic, which then went to a TOR instance to be routed.