Linux 配置 ProxyChains 上网

本文最后更新于:2022年11月4日 下午

概述

ProxyChains是一个LinuxUnix下的代理工具,允许TCPDNS通过代理隧道,支持HTTPSOCKS4SOCKS5类型的代理服务器,且可配置多个代理。

ProxyChains通过用户自定义的代理列表强制连接指定的应用程序。

本文简述Linux下如何通过ProxyChains使用Clash主机代理。

相关资料

GitHub项目地址

ProxyChainshaad/proxychains: proxychains - a tool that forces any TCP connection made by any given application to follow through proxy like TOR or any other SOCKS4, SOCKS5 or HTTP(S) proxy. Supported auth-types: “user/pass” for SOCKS4/5, “basic” for HTTP. (github.com)

ProxyChains-ngrofl0r/proxychains-ng: proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.

安装ProxyChains4

kali默认预装proxychains4,其它基于DebianLinux发行版可通过如下命令安装:

1
apt-get install proxychains4

或者

1
apt-get install proxychains

文件配置

1
vim /etc/proxychains4.conf

如果刚刚是用apt-get install proxychains安装的话就是修改:

1
vim /etc/proxychains.conf

取消dynamic_chain的注释,也可以注释掉strict_chain:

注:请在代理软件上勾选允许本地网络连接选项。

在这个配置文件最下面有[ProxyList]这么一行,在这行下面添加上:

1
2
socks5 127.0.0.1 7891 
# 7891 取决于yaml的配置

如果有别的比如socks4 127.0.0.1 9050那么就把它给注释掉。

重启,若要在代理下使用某条命令,则

1
proxychains [command]

即可在proxychains代理规则下启动。

比如说使用curl的时候用代理:

1
proxychains curl -fsSL https://get.docker.com | sh

例如使用snap的时候用代理:

1
2
3
4
5
6
root@raspberrypi:~# proxychains snap install docker
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/aarch64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] DLL init: proxychains-ng 4.16
Download snap "docker" (1783) from channel

测试网络:

1
ping google.com

Linux 配置 ProxyChains 上网
https://pawswrite.xyz/posts/34687.html
作者
Rainbow
发布于
2022年5月31日
许可协议