Port forwarding more than once

William Hooper whooper "at" freeshell.org
Fri Jan 9 19:58:01 2004


Rachan Malhotra said:
> Well, here's what I want. Hope I made it clear this time.
>
> I want to create a long SSH tunnel running from my laptop to one server
> and from there to another. Also, I want to forward port x on my machine
> to the 1st server and then to the 2nd server through this tunnel. Is it
> possible to create an SSH tunnel among three (or more) machines ?

It's clear that it is still and SSH question, not a VNC one.

Please answer two questions:

1) Can the second machine access both endpoints of the connection?

2) Is the second part of the network (between the second machine and the
third) a trusted network?

Of both answers are yes it is easiest to use the command I gave before. 
If (2) isn't true, it would probably be easier to forward SSH rather than
trying to forward VNC.

ssh -L 2222:third:22 second

Then on the first machine you can do:

ssh -L 5901:localhost:5901 -p 2222 localhost

and be talking to the third machine.

-- 
William Hooper