1

I want to use my primary internet connection (eth0) on my PC for all traffic, but route traffic over a pptp VPN for specified application/or port.

Details

eth0 = current internet port

pptp1 = VPN connection which ha its own public IP address accessible from the internet.

The connection I want to route out of the pptp1 interface is in response to an incoming connection.

Incoming port will be always: 33340 Outgoing port can be change, but usually it is 33330

  • It is possible that the incoming connections to 33340 will always be from a specific set of IP addresses? – Paul Nov 24 '11 at 23:33
2

So, if I understand correctly, both eth0 and pptp1 reach the Internet. eth0 is directly through your ISP and pptp1 is a tunnel to your VPN provider. I'm assuming from these interface names you are using Linux.

Easiest and most secure thing to do unless you know for a fact the application is not going to make connections on any other port is to set the IP address of pptp1 as your default gateway. This will make ALL traffic go through the VPN.

If you certainly don't want to do that, since you are using Linux, you have access to iptables. I don't know if the DNAT target of iptables allows you to jump interfaces.

But have a look here - https://unix.stackexchange.com/questions/12085/only-allow-certain-outbound-traffic-on-certain-interfaces

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.