How to bypass firewall and NAT with reverse SSH Tunnel

后端 未结 3 2051
囚心锁ツ
囚心锁ツ 2020-12-23 23:28

I\'m trying to generate an SSH server in a machine behind a router.

First I tried to bind the SSH to my public IP address:

ssh -R 10002:localhost:22          


        
3条回答
  •  情歌与酒
    2020-12-24 00:12

    Is there a ssh-server running on the public "ip_address"? What you're trying to do is "open ssh connection to "ip_address" and then tunnel any incoming request on port 10002 to localhost:22".

    If "ip-address" is the public IP address of your dsl-router, you have to create a port-forwarding in the router's configuration to your host:22.

    If you do not have access to the router, the only possible thing would be if you had access to another server running ssh in the internet, from which you can tunnel.

    # open a session to the public available machine and create a tunnel from port 10002 back  to your local sshd (22)
    ssh -R 10002:localhost:22 ip_of_public_server
    # as long as this session is open, all calls to the public available machine on port 10002 will be tunneled to your local machine (make sure sshd is running on port 22)
    ssh -p 10002 ip_of_public_server
    

提交回复
热议问题