Ok, explanation of what I want to achieve.
I have an ubuntu server 18.04 with this setup:
Router Internet <-> ethernet via eth0=192.168.0.10 / gw 192.168.0.1 Router Internet VPN <-> wifi via wlan0=192.168.200.10 / gw 192.168.200.1
If I do for example a traceroute using wlan0, I'm able to go via the VPN, and if I use the eth0, I go directly via internet without vpn.
In this server I have: Pi-hole and deluge. and what I want to achieve is make deluge use internet via wlan0 (then, go via the vpn that is in my router), and I be able to access from 192.168.0.X to the server and see Pi-hole and deluge web interface.
What I alredy try,and I think this is the best and easy solution, reading in several forums with iptables is the next:
sudo iptables -A OUTPUT -m owner --gid-owner deluge -o lo -j ACCEPT sudo iptables -A OUTPUT -m owner --gid-owner deluge \! -o wlan0 -j REJECT sudo iptables -A OUTPUT -m owner --gid-owner deluge -o eth0 -d 192.168.0.0/24 -j ACCEPT
With this the only thing that I achieve is:
1) torrent "looks like" is using vpn because whatever thing that was uploading or downloading is stopped.
2) I can access to the deluge web interface only via the same network (192.168.200.X, but I want to access from 192.168.0.X)
This is my actual routing table:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 202 0 0 eth0 0.0.0.0 192.168.200.1 0.0.0.0 UG 303 0 0 wlan0 192.168.0.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0 192.168.200.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
Any idea how to solve this in an easy way? I'm fighting for this for months already....