I have this situation:

server 1: public ip x.x.x.x private ip

server 2: private ip

The server 1 can reach the internet with both interfaces:

ping -i x.x.x.x www.google.com
www.google.com is alive

ping -i www.google.com
www.google.com is alive

The server 2 can reach only the server 1 via ssh. I need to update some packages and install some new ones on this server (all shell commands). I tried already using:

ssh -D 9001 root@server1

and exporting http_proxy/ftp_proxy with localhost:9001 on server 2, but it seems to not work. How can I use the public connection of server 1?


The -D option enables a SOCKS4/5 server. It is not identical to an normal HTTP/FTP-proxy and need therefore to be interfaced differently. A lot of browser support SOCKS proxies, but usually not via a http_proxy/ftp_proxy environment variable.

You can wrap programs, which do not support SOCKS directly, with tsocks.

See also https://superuser.com/questions/262956/how-to-invoke-a-command-using-specific-proxy-server and How to download a file through an SSH server?

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.