Skip to content

Instantly share code, notes, and snippets.

@xaviervia
Created October 10, 2012 02:06
Show Gist options
  • Save xaviervia/3862733 to your computer and use it in GitHub Desktop.
Save xaviervia/3862733 to your computer and use it in GitHub Desktop.
Reverse SSH tunneling

Let's assume that Destination's IP is 192.168.20.55 (Linux box that you want to access).

You want to access from Linux client with IP 138.47.99.99.

Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99)

  1. SSH from the destination to the source (with public ip) using command below:

    ssh -R 19999:localhost:22 [email protected]

  • port 19999 can be any unused port.
  1. Now you can SSH from source to destination through SSH tuneling:

    ssh localhost -p 19999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment