Skip to content

Instantly share code, notes, and snippets.

@maxcnunes
Created June 17, 2015 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxcnunes/22d8a7d453e4f57e07b3 to your computer and use it in GitHub Desktop.
Save maxcnunes/22d8a7d453e4f57e07b3 to your computer and use it in GitHub Desktop.
ssh tunnel and multiple tunnels
# single tunnel
ssh -L <local-ip-on-my-machine>:<local-port-on-my-machine>:\
<local-ip-on-server>:<local-port-on-server> \
-C -N <server-user>@<server-ip>
# EXMAPLES
# -------------
# SINGLE TUNNEL
ssh -L 0.0.0.0:27017:172.17.42.1:27017 -C -N core@192.168.0.100
# -------------
# MULTIPLE TUNNELS
ssh -L 0.0.0.0:27017:localhost:27017 core@192.168.0.100 \
ssh -L 27017:172.17.42.1:27017 -N core@192.168.0.101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment