SSH Tunnel

If you have a server with SSH access, you can use it as sock 5 proxy or for port forwarding with just ssh access.

Socks5 Proxy

SSH tunnel can be used for browsing security. It act like a socks5 proxy.

OR

SERVER_IP is IP of the remote server, that you will be using as sock 5 server.

You can configure your browser to use sock5 proxy with IP address 127.0.0.1 and port 7373. You can change port by changing port in above commands.

-N = Do not execute a remote command. This is useful for just forwarding ports.
-f = go into background mode.

Forwarding Remote Port to local

You have a remote server that run a service on some port, that is not accessable to public. This is useful for services like MySQL, redis that is bind to 127.0.0.1 by default for security reason.

Example

MYSQL running on remote server will be available on port 9999 on local computer.

You can add -f -N option in cause you need above ssh command run in background.

Forwarding local port to remote server

Lets say you have a local web site running on your computer, you need to show this to your customer. You can’t make the web site from your computer as you are behind NAT network and your router don’t support port forwarding.

To forward local port to remote server, run

Example

Service running on port 80 on local computer will be available on remote server on port 8080. Your customer can view the web site using url REMOTE_SERVER_IP:8080

See SSH, SSH Port Forwarding

Leave a Reply

Your email address will not be published. Required fields are marked *