Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 am going to connect to a VPN service provider. From VPN I'll get a public ip. When I simple connect to this pptp VPN, all ingoing-outgoing traffic will be forwarded to the VPN. Am I right? However what if I'd like to send traffic only on specific ports through the vpn, so for example p2p traffic, etc. I want to access that port from the VPN's public ip after that. It is possible to configure a vpn client this way? Sorry if this is a stupid question i'm pretty new to this.

share|improve this question

Traffic flows through IP connections based on routing decisions. The question of whether a particular piece of traffic goes through the VPN depends on the configuration of the server and the client. Usually the client will receive additional routes from the server. There has to be at least one such route to make sure that traffic for the other endpoint is routed into the tunnel.

If your VPN is configured such that it changes the default gateway of the client upon connection, then all your traffic is routed through the VPN. And between that and the bare minimum, everything is possible.

However, having said this: FTP is a layer 3 protocol, and VPN tunnels usually operate at layer 2. In other words, they do not recognize that a particular request is for FTP. And your normal routing mechanisms cannot make that distinction, either.

Now: if the FTP site you want to reach is available from both the VPN and the public Internet, then you could use split DNS to achieve this. Usually, when a VPN connection is established, the name server settings of the client are (for the duration of the connection) replaced with settings forwarded by the server. This is done so that the client can use host/service names residing in the target network.
If you now add DNS records to the DNS server used in the target network, which will resolve the relevant FTP sites to different (internal) IP addresses, then these different IP addresses will result in the FTP traffic going through the tunnel. As soon as the VPN connection stops, the original DNS settings are restored and the same URL now resolves again to the public IP address.

Please note that this trick will only work for FTP sites that can be reached both through the public Internet and the VPN (i.e. company internal resources).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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