From what I have seen, the current fix involves fwmark based routing, similar to what was used in X3MRouting and now also in "Domain VPN routing". This method is fragile and conflicts with AIProtect as both are using FWMark and currently there are no bits left unused. The current scheme would have to be expanded with more bits to allow for both OpenVPN and Wireguard selection which further increases the risk for conflict.
Ive remember seeing this function in Unbound Manager and if I remember correctly it sets in unbound.conf:
Code:
#outgoing-interface: xxx.xxx.xxx.xxx
to
Code:
outgoing-interface: <vpn ipv4>
and then rp_filter to loose (or off) for that interface which FW already does for openVPN but not necessarily for Wireguard. Alternatively use the VPN Director rule to send that interface to wgcX as you already do with ping and speed test.
this would force Unbound to only use that specific interface. but for this to work it has to be set whenever the tunnel starts followed by unbound restart and reset if the tunnel is stopped. otherwise you may loose DNS if the tunnel stops, breaks or fails to start. in order to do this, VPN-start and stop hook files would be used to tell Unbound Manager what to do.
again, it's tricky and potentially fragile.
Im doing it differently. I simply edit unbound.conf (command "vx" inside Unbound manager) and set
Code:
outgoing-interface: 192.168.50.1
so, I set it to my LAN ipv4.
This wont really do anything normally. Router would itself typically only use this source address when talking to lan clients and additionally for the few apps that are bound to LAN interface (like the web UI).
The plan is to route this IP to our Wireguard interface of choice, but in order to do that without messing up WebUI for example if are using the killswitch, we make a VPNDirector rule to make sure Router to LAN communication uses Main route table so it wont be affected by any killswitch or whatever is going on in the policy route table:
LocalIP: 192.168.50.1
RemoteIP: 192.168.0.0/16
IFace: WAN
with this rule we will make sure that we are not affecting any local packets in the process.
now we can add a second VPN Director rule to send Unbound to our Wireguard interface:
Local IP: 192.168.50.1
Remote IP: <blank>
IFace: wgcX
and now Unbound works via our Wireguard interface whenever wgcX are enabled. if it is disabled, the FW removes the rules and Unbound will work over WAN. we could create duplicates of the last rule if we want foldback to other wireguard interfaces.
There is always a risk that we are affecting other applications on the router that are set to use the LAN ip that communicates externally, but I have not found any issues with it. For example, if anyone uses GUI access from WAN it would probably break that, but that would be bad practice anyway.
An even more reliable way of doing this would be to create a LAN alias interface (much like Diversion is doing with pixelserv) and setup DHCP to not give out that ip. then set Unbound to use that alias interface and create a VPN Director rule for it to the Wireguard interface. Then we could be sure we are not affecting anything else.
Some reference links from the Wireguard Manager days:
https://github.com/ZebMcKayhan/Wire...p-transmission-andor-unbound-to-use-wg-client
https://github.com/ZebMcKayhan/Wire...-andor-unbound-to-use-wg-client-alternate-way
I would personally try to stay away from using fwmark based routing based on the conflict with AIProtect but that is just me. But even though the br0 ip way have been used by many people I have never had any reports of issues I cant guarantee it. but it is easy enough for anyone to play with as long as they adjust the ips in the rules and unbound.conf to fit their system.