Super User is a question and answer site for computer enthusiasts and power users. 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 have a VM, accessible via Now I want to create a tunnel: ->

where is the IP address of the loopback interface of the VM. The host OS has a route to and no package forwarding enabled.

Is it possible to do this solely with SSH? If yes, how?

share|improve this question
I've assumed some stuff in my answer, if it's wrong let me know and I'll clarify. – EightBitTony Jun 20 '11 at 20:23
up vote 3 down vote accepted

Try ssh -R username@ from the host.

This will forward on the VM to over the tunnel.

share|improve this answer
Ah yes, I misread the query, the subtle difference between -L and -R is the key! – EightBitTony Jun 20 '11 at 20:30
Great, thank you! – Philip Jun 20 '11 at 20:48
ssh -L me@

That creates the tunnel from some workstation, through to

I'm not sure your question is really asking that - but that's the answer that makes most sense. Since the VM can already reach I'm presuming you've got a third machine (a workstation for example) that wants to reach google, via the VM.

But this creates a tunnel such that workstation is listening on port 12345, and any traffic sent to that port goes to your VM and then out to Google.

share|improve this answer
ssh  username@  -L

Then, connect to localhost:12345 to access Also, you could use

ssh username@  -D localhost:12345

to let ssh decide where to connect to (e.g. at the time that you connect to localhost:12345 with your application.

I believe either of those will do the trick.

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.