I have this situation:server 1: public ip  x.x.x.x          private ip 192.168.0.1server 2: private ip 192.168.0.10The server 1 can reach the internet with both interfaces:ping -i x.x.x.x www.google.comwww.google.com is aliveping -i 192.168.0.1 www.google.comwww.google.com is aliveThe 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@server1and 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?
Tunnel HTTP traffic using another machine via SSH
ssh;proxy;port forwarding;socks
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?