SSH Port Forwarding

From JasonAntmanWiki
Jump to: navigation, search

A properly configured SSH server will allow a user to forward a port to the local machine.

In essence, this allows you, at your local machine, to connect to a local port and have all data sent and received pass through a secure SSH tunnel to the remote server. At the remote end, this data will be sent to a specified machine, as if it emanated from the server.

In a few simple examples:
Connecting to an IPcop web interface:
ssh -L 2022:192.168.0.1:445 yourname.dyndns.org
This will forward port 2022 on localhost through your SSH server to port 445 on 192.168.0.1 on the remote LAN. This is assuming that your remote SSH server is *not* the IPcop box.
To access port 445 on remote LAN host 192.168.0.1, once the SSH connection is established, open a browser to https://localhost:2022. This will give you access to 192.168.0.1:445 on the remote LAN, and all traffic will be going over a secure SSH tunnel.

ssh -L 2022:192.168.0.1:3306 yourname.dyndns.org
This allows forwarding of MySQL. To connect to the MySQL server in port 3306 of remote machine 192.168.0.1, you would just connect as if the MySQL server were running on port 2022 of your local machine.

Views
Notice - this is a static HTML mirror of a previous MediaWiki installation. Pages are for historical reference only, and are greatly outdated (circa 2009).