Ssh – How to access a proxy enabled internet with ssh tunneling

connection-refusednetworkingPROXYsshssh-tunnel

I have two pc (A & B, Both are running ubuntu 16.04) that are connected through Local Network. PC-A has Internet connection. I want to browse internet in PC-B using ssh tunneling.

I used the command in PC-B –

ssh -D 9999 user@IP_ADDRESS

Then i set HTTP, HTTPS, FTP Proxy empty and SOCKS Proxy "localhost" and port 9999.

If PC-A has Internet connection which is not requires proxy setup , then i can browse network in PC-B using above command.

But if PC-A has Internet conenction which requires HTTP Proxy "xxx.yy.zz.zz" and port 8080 then i can't browse internet using the above command and terminal shows following error:

"channel 3: open failed: connect failed: Connection refused".

What should i do ? Any help is appreciated.

Best Answer

Have you considered running a proxy server, maybe squid, on PC-A? Then you can create a tunnel from PC-B on a given port to the input port on PC-A of the squid daemon.

Then you can configure squid to either use another upstream proxy (http://www.christianschenk.org/blog/using-a-parent-proxy-with-squid/) or directly connect to the internet depending on what you need.