ssh tunnel for port on internet without port forwarding

Hi, the below command do really have magical effect to bring ur local port on internet,

Support you are on nat (nat like you have 192.168.1.2), and you dont have public ip, but you want to show your friend your webserver, or you want him to ssh your system remotely so you need to forward your port with router that may or may not have public ip.

But if you have a remote server with public, like i do have this server, you can use that to do this task from remote. And that is very easy you can find many tutorials on internet for reverse ssh tunnel.

here are those very  easy steps you need to perform-

  1. set “GatewayPorts yes” without quotes in sshd_config file of ssh, available at /etc/ssh/sshd_config in ubuntu os
  2. use this command “ssh -g -R 8080:localhost:80 [email protected] -p 22” without quotes and you will see server.com:8080 shows what your lcoal web server has got

Enjoy I had to do a lot of research to get this successful in my case and now found that this something like path to heaven for me. it takes all the traffic encrypted with ssh protocol hehehe.

and use ssh -f -N -R 9108:localhost:80 [email protected] -p 2222 if you dont want ssh to open everytime

0

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*