Port forwarding using SSH

This trick allows to forward a service which can be accessed only inside a specific network to your machine (localhost).

Let’s suppose you have a specific server 192.168.1.7 which can be accessed only from the following machine 88.190.247.12 or another machine inside the 88.190.247.0 network.

Then, you type :

ssh -L3309:192.168.1.7:3306 user@88.190.247.12

And you can now access your service from localhost:3309 !

Note: If you leave the SSH connection, the port forwarding will be lost.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s