Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


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

share|improve this question
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

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 -

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .