How to force some traffic to use a VPN
Ok, so I've recently started using a VPN provider with an OpenVPN setup for my home server. This introduces complications, in that I run a mailserver etc on it, and once the VPN is active, ddclient advertises the VPN endpoint as my IP, and as port forwarding doesn't exist down the tunnel, no traffic actually gets into the server. This also applies for SSH traffic etc - currently I'm jumping through my Pi to get there externally.
I have an idea as to how I could solve this, but I need to run it past someone who has more knowledge on the situation before I attempt a solution. I know I can force the applications I want to tunnel to use a specific interface, and I know that you can bind OpenVPN to a specific interface, so would it be theoretically possible to bring up a pseudo interface, bind the VPN to that and then make the applications use the pseudo interface? Is this a practical solution? If so, what would I need to do to achieve this? Obviously I'd want any traffic coming in the VPN to then leave via it again, or it will defeat the object.
Thanks in advance!
|