Preface
proxychains is a UNIX/LINUX program that redirects TCP connections of applications to specified proxy servers through secure tunnels. The protocols supported by Proxychains are SOCKS4, SOCKS5, HTTP, and HTTPS. Compared with general similar tools, the characteristic of ProxyChains is that it only forwards the TCP connections of the current application to the proxy, rather than directly implementing a global proxy. In fact, most of the time we only need some applications to go through the proxy, so ProxyChains is more in line with our general use cases.
Deployment and Basic Configuration
It can be installed on all Linux distributions. To install, type or copy the following command in the Linux terminal:
sudo apt-get install proxychains
Before using the proxychains command, you need to edit the configuration file to specify the proxy address and port:
vim /etc/proxychains.conf
Simply add the proxy server at the end, for example, adding an HTTP proxy with the address 192.168.1.1 and port 12345:
http 192.168.1.1 12345
As shown in the figure below:

Here is a usage tip, which is to use it in conjunction with virtual networking. If virtual networking software (such as tailscale) is installed on the cloud server, the cloud server can directly use the virtual networking address to access devices at home that also have virtual networking installed (and what if this home device happens to have bypass capabilities, and happens to provide proxy functions?). Therefore, you can directly specify the virtual networking address and corresponding port of the home device in the configuration file. Of course, mapping the public IP address also works, but it is not as secure as directly using the virtual networking address. In the days to come, safety first.
Using ProxyChains is very simple: just prepend proxychains before the application:
proxychains docker pull xxxx
The effect of using this method to solve the problem of cloud servers being unable to pull docker images is immediate.
You can usecurl cip.cc和proxychains curl cip.ccCompare the execution of the two commands:
This is normal access, and you can see that the returned address is directly the address of my cloud server:

But after using proxychains, the final returned address is my home broadband address:

This is because the request has been forwarded to my home proxy via the tailscale address, and when the proxy goes out from home, it naturally uses the broadband address.
As for other application scenarios, you can use your imagination.
proxychains Advanced Techniques: Proxy Chains
proxychains supports 3 types of proxy chains: strict chain (strict_chain), dynamic chain (dynamic_chain), and random chain (random_chain):

Note: You can only choose one of the above three proxy chain methods. To use one, simply uncomment it by removing the # and comment out the other two with #.
Strict Chain
A chain is formed according to the order in which the proxy servers are added in the configuration file. User requests must strictly pass through all proxy servers in that order. This method requires all proxy servers to be available, which is also the default working mode of proxychains. If in the configuration file mentioned earlier in the articleproxychains.confmore than one proxy server is added at the end, the strict chain mode will take effect. At this time, if one proxy server is unavailable, proxychains will not work properly.
Dynamic Chain
Similar to the strict chain, the dynamic chain also forms a chain according to the order in which the proxy servers are added in the configuration file. However, the difference is that if any of the proxy servers are unavailable, the dynamic chain will automatically exclude them. Therefore, as long as at least one proxy server is available, the dynamic chain can work normally.
If you want to use a proxy chain, the dynamic chain is the recommended method.
Random Chain
As the name suggests, the random chain randomly selects the proxy servers added in the configuration file. This method is suitable for network scanning.chain_lenparameter only takes effect in the random chain mode, which can define the length of the random chain, defaulting to 2.
Note: For the detailed concept and construction of proxy chains, please refer to my other article:Home Data Center Series - Using gost to Build Your Own Proxy Server and Forwarding Proxy Chains。
Afterword
Actually, this is an old article I wrote before, but it was written rather roughly. The reason I rewrote this article is that I plan to write articles about gost and Proxifier. These three software programs actually complement each other and can be called the "Three Musketeers of Proxies". So I decided to go back and reconstruct this previously written article to echo the other two articles, which also counts as churning out another post.
In addition, proxychains is a terminal-based tool, and its similar desktop-version counterpart is Proxifier. For its usage, please refer to the article:Home Data Center Series: Using Proxifier to Route Applications That Do Not Support Proxies but Need Them Through a Proxy。