SSH Tunneling Essentials

Linux Logo

SSH Tunneling Essentials

Server Prerequisites

TCP Forwarding Enabled on an OS level

see Enable IP Forwarding in Linux

TCP Forwarding Enabled on SSHD level

sudo nano /etc/ssh/sshd_config
  • AllowTCPForwarding is either not present, is commented out, or is set to yes
  • PermitOpen is either not present, is commented out, or is set to any[1]

Local Examples

Remote computer 10.10.10.10 has a service running on TCP 8384 that is only listening on its 127.0.0.1 interface.
To access that service on your local machine via 127.0.0.1:9900

ssh -L 127.0.0.1:9900:127.0.0.1:8384 pi@10.10.10.10

ssh -L 80:intra.example.com:80 user@gw.example.com

Remote Examples