你可以从Linux命令行设置socks5代理吗?

Ale*_*exP 6 ssh networking proxy port-forwarding socks5

我已经成功地从 Linux 向另一台服务器设置了ocks5代理服务器,如下所示:

\n

ssh -D 9090 -N -f user@192.168.76.102\n然后我更改了mozilla浏览器中的设置以使用socks代理,并且它有效,我可以上网。我想要做的是在 Linux 命令行中设置此设置,这样我就可以从那里访问互联网,如下所示:wget www.google.com \n首先我尝试编辑 /etc/environmental 文件:

\n
export http_proxy=socks5://127.0.0.1:9090 \n\n
Run Code Online (Sandbox Code Playgroud)\n

但它不起作用:

\n
wget www.google.com \nError parsing proxy URL socks5://127.0.0.1:9090: Unsupported scheme \xe2\x80\x98socks5\xe2\x80\x99.\n\n
Run Code Online (Sandbox Code Playgroud)\n

然后我安装了 proxychains4 ,并在 /etc/proxychains4.conf 中添加:

\n

socks5 127.0.0.1 9090

\n

但仍然不起作用:

\n
Resolving www.google.com (www.google.com)... failed: Temporary failure in name resolution.\nwget: unable to resolve host address \xe2\x80\x98www.google.com\n
Run Code Online (Sandbox Code Playgroud)\n

您对我如何完成这项工作有什么想法吗?

\n

谢谢。

\n

Raf*_*ffa 12

您使用了错误的工具来测试您的 SOCKS 代理设置。wget没有内置的 SOCKS 支持,但支持 HTTP / HTTPS。

curl另一方面,它内置了对 SOCKS 的支持,因此您应该使用它。

请参阅mancurl了解信息和用法。

  • 我用过:``curl -xocks5h://localhost:9090 http://www.google.com/-ooutput.curl``它有效,谢谢 (2认同)