Creating a SSH-tunnel in Linux

icon3
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Posted October 4, 2007 at 13:11 (UTC)

Sometimes I need to make a tunnel through a SSH-server if I’m unable to reach a service beyond the LAN. That’s a SSH-tunnel (clever name!). Actually I’m often having problems remember which arguments to pass to the SSH-client, so just a little reminder to myself. I naturally hope that it can help someone else, too:

1
ssh user@ssh-server -L local-port-to-bind-to:host-to-reach:the-port-on-the-host

Or maybe in a more readable format:

1
ssh user@ssh-server -L x:y:z

where
x = the local port to bind the tunnel to
y = the host that should be at the other end of the tunnel, so to speak
z = the port on the host

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.