1. Local tunneling
Run the command below on your local PC.
ssh -Nf -L 9000:www.google.com:80 server_user@your_ssh_server.com
In your browser go to
2. Remote tunneling
Run the command below on PC you want to access.
ssh -Nf -R 9922:127.0.0.1:22 server_user@your_ssh_server.com
Run the command below on PC you are using outside.
ssh local_user@your_ssh_server.com -p 9922
3. Autossh
$ cat /etc/init/autossh.conf
description "autossh tunnel"
start on (local-filesystems and net-device-up IFACE=eth0 and net-device-up IFACE=eth1) # assuming we have multiple interfaces
stop on runlevel [016]
respawn
respawn limit 5 60
exec autossh -M 0 -N -R 6607:127.0.0.1:22 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o "StrictHostKeyChecking=no" -o "BatchMode=yes" -i /home/bignet/.ssh/id_rsa test@110.119.122.2
$ sudo service autossh status
autossh start/running, process 24254