Skip to content

Instantly share code, notes, and snippets.

@junaidk
Last active January 14, 2020 06:18
Show Gist options
  • Save junaidk/0c0c8c37cdc907885a46d0e601e32ccf to your computer and use it in GitHub Desktop.
Save junaidk/0c0c8c37cdc907885a46d0e601e32ccf to your computer and use it in GitHub Desktop.
creat ssh tunnel

ssh tunnel from jump server

https://coderwall.com/p/tk_pwa/ssh-into-a-secured-host-through-a-jump-server-and-forward-ports

ssh -v -t -L 10443:localhost:20443 <jump_server> ssh -t -L 20443:localhost:443 user@<target_server>

ssh -v -t -L 9292:localhost:9292 [email protected] ssh -t -L 9292:localhost:9292 [email protected]

simple tunnel

use -N to skip shell

ssh -T -f -N -L 31808:localhost:31808 [email protected]

reverse tunnel

https://unix.stackexchange.com/questions/46235/how-does-reverse-ssh-tunneling-work/46271#46271

ssh -f -N -T -R22222:localhost:22 [email protected]

This tells your client to establish a tunnel with a -Remote entry point. Anything that attaches to port 22222 on the far end of the tunnel will actually reach "localhost port 22", where "localhost" is from the perspective of the exit point of the tunnel (i.e. your ssh client).

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