Remote access to protected networks using ssh tunnels established from inside to outside.

On the inside box:

 ssh -p 22 -f -N -T -R65522:localhost:22 user@host.outside.net

-f —> go to background
-N —> no remote commands at the moment
-T —> no interactive shell yet
-R65522:localhost:22 —> everything connecting port 65522 on the outside box will be connected to port 22 on the inside box.
-p 22 —> the port the tunnel accepting sshd is listening on the ousidebox during the tunnel build up
user@host.outside.net —> the user ”user” on the outside box ”host.outside.net” accepting the tunnel.

On the outside (for ssh):

 ssh -p 65522 user@localhost

user —> the user on the inside box

Example connecting to a web server inside companys network from outside:

Inside, on the web server:

 
 ssh -p 22 -f -N -T -R65580:localhost:80 user@host.outside.net

Outside:

 links http://localhost:65580

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.