Skip to content

Instantly share code, notes, and snippets.

@j18e
Last active January 8, 2018 15:23
Show Gist options
  • Save j18e/c030eb60a447161632b628be0b9ee680 to your computer and use it in GitHub Desktop.
Save j18e/c030eb60a447161632b628be0b9ee680 to your computer and use it in GitHub Desktop.
SSH Port Forwarding
# $HOME/.ssh/config
Host example-forward
HostName bastion.example.com
ForwardAgent yes
ForwardX11 yes
LocalForward 9090 app-0.example.local:8080
# this allows you to run `ssh example-forward`
# you'll get an SSH session but more importantly,
# requests on localhost:9090 will be forwarded past the bastion onto its local network
# and finally to port 8080 of the app-0 server
# maybe to access the web console of app-0 you'll need to address it as app.example.local
# in which case you should add a line to /etc/hosts:
# 127.0.0.1 app.example.local
# then go on a web browser to http://app.example.local:9090
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment