I use a commercial VPN provider with OpenVPN as client on Ubuntu Server 14.04 LTS (but doing some testing on 16.04 LTS too). I have configured iptables and routing tables to mark packets based on user and to route only these packets over tun0. Every other user has direct access to Internet (over eth0). It works great. I run services that I want to be routed over VPN as user vpn, and user vpn is routed over tun0.
I can't figure out how to access a service's port that is run under vpn user, that is, tunneled over tun0, from my local network. A concrete example:
Transmission is running as vpn user and tunneled completely over tun0. The default port for Transmission web ui is 9091, so one can access web ui with http://serverip:9091 However, I just can't access port 9091. I receive no error message in browser, just doesn't work. I guess I would need to add an iptable entry that would make port 9091 on tun0 available (routed?) from eth0? If I'm thinking correctly, what is the correct rule and way to do this? Transmission is working great, since I can access webui with nginx reverse proxy, meaning port 9091 as accessible to localhost on the server, but not to the local network over eth0.
I don't need port access from WAN side, so it basically has nothing to do with the VPN provider I use, I just need access from my local network (192.168.1.0/24).
Many thanks and looking forward to your help, suggestions!