Portforwarding TLDR guid

Forward port to another server [L]

TODO

ssh -L 8081:localhost:8080 example.com

Get a port from another server and connect it locally [R]

  • 22: ssh port of the machine example.com
  • 8081: Using this port on the localmachine you can ssh from your local pc; ssh -p 8081 example.com. You can use this to connect a webserver of database to your localmachine. Another usecase can be port 80 website, that is not normally accissible.
  • localhost: machine you want this port to be connected to: Example where you want gw website connected to the intra server :ssh -R 80:intra.example.com:80 gw.example.com. This is called Jump server.
  • example.com: the server you want to the port from
ssh -R 8081:localhost:22 example.com