1

Say I have a server inside a dataware house. I can connect to it remotely from my PC but it does not have Internet access.

Is it possible to configure the SSH connection or any other configuration in such a way that the remote server can have Internet connection through my PC ?

1

Yes, use your PC as a proxy. There are many ways to set up a proxy on your PC and there are many ways how the server can access your PC to use that proxy. It all sort of depends what you had in mind. Here two examples.

  • One option is to use openssh on your PC to provide a socks5 proxy for the server to connect to. Server uses ssh with the "-D" switch to connect to your PC. Firefox and others can easily connect to it. This may give you some inside Use socks proxy for commands in terminal

  • A light weight http proxy that I used in the past is tinyproxy. It even runs on TP-Link router with openwrt. Accessing a http proxy is normally even easier than a socks5 proxy, even though a socks5 proxy is more powerful.

Openssh has the advantage that is it preinstalled on basically any linux computer.

| improve this answer | |
  • Using ssh client (putty) on my PC and sshd on linux server is it possible to do it ? I mean, I already establish a connection from my PC (client) to the remote server. Can I use this connection for the proxy? – mquevedob Jun 19 '16 at 23:12
0

Althogh previous answer is correct, it is not complete, so I thought answering this question myself the way it worked for me so i may help other with the same need. (my PC is windows and my server is Linux)

  1. download and install squid proxy for windows. follow these steps

    http://www.mrcnit.com/how-to-setup-squid-proxy-server-in-windows-7810-or-windows-server/

  2. Use putty to SSH to your linux box before connecting to your linux box, go to Connection->SSH->Tunnels option (if you have a session with your server information saved in putty, remember to load it first) in the "Source port" field enter 3128 in the "Destination" field enter localhost:3128 in the options below, select "Remote" Click "Add" click "Open"

  3. once connected to your remote linux box, enter the following command

    export http_proxy="http://127.0.0.1:3128"

from now on, every wget or curl you execute, it will use your SSH reverse connection to go to the internet through your PC connection.

  1. In case you are using a Linux PC and want to give internet access to your Linux Server, you won't be using putty, but your own ssh client. In this case, edit the file (or create) ~/.ssh/config and enter the following

    Host * ServerAliveInterval 30 RemoteForward 3128 127.0.0.1:3128 RemoteForward 52698 127.0.0.1:52698

This will create the reverse connection to your linux PC

I hope this lights up the way to some lost souls as I once was...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.