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 have a Debian VPS with an assigned static IP. I want to setup a virtual interface (with an ip like 192.168..) on my laptop (Ubuntu, dynamic IP) linked to the remote VPS, so that if I bind sockets to it the traffic is tunneled to the VPS and sent to the Internet from there. Port forwarding must be available.

This looks like a job for a VPN software, but I'm clueless about the pieces of software needed. Any advice?

share|improve this question

You can do some of this just with ssh. It depends on your client, but the command line version goes as follows, and putty and other ssh clients have the facility to do this.

First approach is called dynamic port forwarding, and effectively turns your ssh session into a socks proxy.

On your local machine, do something like:

ssh -D8080 user@debianvpsip

In your browser, or any other socks proxy aware software, you can set the proxy server to be, and any traffic sent to this port will go out to the internet as if originating from your vps.

The second approach, if you wanted to target a specific destination, you can use local port forwarding:

ssh -L1234:remoteip:80 user@debianvpsip

This creates a local port and any traffic sent to this port will be forwarded to remoteip:80

In both cases the traffic will appear to originate from your Debian VPS.

share|improve this answer
does this work with other protocols than TCP? I need to tunnel UDP packets also, and ICMP would be nice too. And I will be dealing with application that aren't designed to use ssh tunnels (one for example pings a list of servers with UDP packets), am I wrong to think that it's easier to trick them with a virtual device and a LD_PRELOAD hack? – Lorenzo Pistone Mar 24 '12 at 19:22

You must log in to answer this question.

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