notes blog about


Tunneling is the process of packaging and transporting one network connection using another one.

Forwarding remote port (firewall tunneling via SSH)

We want to allow the tech access the incomp (intranet) host from the (Internet) host:

SSH Tunneling

1) Redirect the port 2222 on to port 22 on incomp:

    incomp:~$ ssh -R 2222:localhost:22$ while [ 1 ]; do date; sleep 300; done  # to keep the connection open

2) Connect to intranet host:$ ssh -p 2222 root@localhost

Note that you need to have SSH server running on both incomp and

Forwarding local port

We want to connect to a home router’s web interface ( to make some configuration changes. The home router is not accessible from Internet. However we can ssh (through port forwarding on the home router) to a host behind the home router (

localhost$ ssh -L 8080:

Nov we enter http://localhost:8080 into the browser on localhost.

We want to connect to a remote database running on dbserver but it is configured to allow connections only from localhost ( We use port 3307 on the client because the default 3306 port is already being used (you are running MySQL server on the client).

client:~$ ssh -L 3307:localhost:3306 root@dbserver
client:~$ mysql -u root -p dbname -P 3307

See also