如何设置一个SSH隧道,而远程服务器本身必须configurationhttp_proxy访问网页?

1,有hostA和hostB两个主机,分别安装了Linux发行版和openSSH;

2,hostA不能访问公网,但可以通过ssh访问hostB;

3,hostB可以访问公网,但是由于防火墙的原因,如果hostB想访问网页(比如stackoverflow.com),我们必须首先在hostB上设置http代理,这可以通过export http_proxy = http_proxy_server:8000在terminal中,或者用proxy_server ip和port 8000设置firefox上的http代理;

4,我可以在hostA上执行“ssh -D 7030 gemfield @ hostB”,然后在hostA上设置firefox上的套接字代理(localhost:7030),但hostA仍然无法访问网页,

5,如何configurationhostB(或hostA)让hostA上的firefox可以通过ssh隧道/套接字代理访问网页?

user@hostA# ssh -L 3128:proxyserver:3128 gemfield@hostB 

然后只需在hostA上将proxy设置为localhost:3128即可。

hostA也可能需要通过hostB传送DNSparsing。 试试这个解决scheme

https://superuser.com/questions/103593/how-to-do-dns-through-a-proxy-in-firefox