Tunnelling

Tunnelling is a cool feature of ssh.

During my work I use a lot of servers and on all of them I need several opened ports. Each opened port is additional security bottleneck. Moreover you should always ask administrators to open all necessary ports – it is tired me.

Tunnelling can solve all these problems! Only ssh-port should be opened.

So you need open tunnel using command:

sudo ssh -l {ssh_username} -L 450:localhost:8080 {external_server_ip}

where:

  • {ssh_username} is name of your ssh user
  • {external_server_ip} is ip of external server
  • 450 is port on localhost, which you should use when tunnel is ready
  • 8080 is port on external server, which will be mapped on your local port (e.g. 450).

After that you may use localhost:450, which will be automatically mapped on {external_server_ip}:8080.

Cool!?