Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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 127.0.0.1:8080, 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 127.0.0.1:1234 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
add comment

Your Answer

 
discard

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.