Using SSH to forward a port to a server....

Geoffrey D. Bennett g at netcraft.com.au
Wed Nov 15 23:23:04 CST 2006


On Wed, Nov 15, 2006 at 04:32:54PM -0500, Peter Lauda wrote:
> I hope someone can tell me how this is accomplished. I think it is fairly 
> simple but can't find the syntax that works.
> 
> What I want to achieve is:
> 
> using ssh I want to setup a remote machine (machineA) that when I connect 
> to it on a specific port.. say 80.. it will forward the connection another 
> IP address..:80. (machineB) and all this would be done through a 3rd 
> machineC and then a client, say IE running on machineD connecting to to the 
> appropriate port on machineC.

I think that last machineC should be machineA?  Anyway, you need
something like this:

machineA> ssh user at machineC -L *:80:machineB:80

Be aware of the security implications of the "*:" after "-L" in that
it opens up the port forwarding to everyone on connected networks, not
just machineD.  Without the "*:" only machineA can use the forwarded
port.

-- 
Geoffrey D. Bennett, RHCE, RHCX               mailto:g at netcraft.com.au
Senior Systems Engineer                          sip:g at netcraft.com.au
NetCraft Australia Pty Ltd        http://www.netcraft.com.au/geoffrey/


More information about the linuxsa mailing list