Setting up a proxy tool server on Linux to enable proxy functionality is a common topic, with numerous tutorials available online. Many people have likely attempted it. However, using a proxy tool for Linux proxy setup as a client proxy might be less familiar to some. This topic recently came up during a discussion with a friend.

Scenario: You have a domestic VPS from Alibaba Cloud/Tencent Cloud or a Linux host on your local network. You want to use a proxy tool as a Linux client to speed up resource downloads. Prerequisite: This guide is for those who have already set up a proxy tool server or have access to an existing node.
Letâs assume you frequently use v2rayN as a proxy client tool on Windows.

Other client tools likely have similar export functionality.
Now, install the v2ray program on your VPS. The installation process for v2ray has changed compared to earlier one-click scripts. Note that on Linux, the v2ray client and server are integrated; the difference lies in the configuration used.
GitHub repository: https://github.com/v2fly/fhs-install-v2ray
Run the following command to install:
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

This indicates a successful installation. The script adds v2ray to the environment variables. The default v2ray configuration file is located at /usr/local/etc/v2ray/config.json.
Replace this configuration file with the client configuration exported from V2rayN.

Then, start v2ray. Since the configuration file is exported from the client, there should be no issues.
systemctl start v2ray
systemctl status v2ray

Check the port listening status:
netstat -antup | grep 1080

This confirms that the v2ray client on Linux has started successfully. By default, v2ray proxies SOCKS traffic. To enable other programs on Linux to use the proxy, traffic must be forwarded to port 1080. Some programs, like curl, natively support SOCKS proxies.

However, this method has limitations, as you must specify the SOCKS proxy each time. Hereâs another way to route terminal traffic through the proxy (not recommended):
export http_proxy=âsocks5://127.0.0.1:1080âł
export https_proxy=âsocks5://127.0.0.1:1080âł
With this setup, programs like curl that support SOCKS proxies will forward traffic directly. However, this approach has limitations, as shown in a comparison between curl and wget.

As you can see, curl works with the proxy, but wget throws an error because it doesnât support SOCKS5. Clearly, this doesnât meet our goal of enabling most Linux programs to use the proxy, which would otherwise be quite restrictive.
Using V2ray in combination with Proxychains is a much better solution. First, install Proxychains.
Since many domestic hosts have slow download speeds from GitHub, you can configure a proxy for git before using Proxychains:
yum install -y git
git config âglobal http.proxy âsocks5://127.0.0.1:1080â
git config âglobal https.proxy âsocks5://127.0.0.1:1080â
Enable the proxy for git:
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng/
make && make install && make install-config
yum -y install proxychains-ng
Proxychains can now be installed via yum.
Once Proxychains is installed, modify the configuration file:
vim /usr/local/etc/proxychains.conf

Add the following line to the end of the file:
socks5 127.0.0.1 1080
Save the changes.
To enable proxying for a program, prepend it with proxychains4, regardless of whether the program natively supports proxies.

I also wrote a simple Python script to test its functionality.

After testing, I found that Proxychains works with most programs, but not with those written in Go. Feel free to test it yourself.
How Proxychains Works:
In simple terms, Proxychains hooks socket-related operations, redirecting regular program socket data through SOCKS/HTTP proxies. The core mechanism leverages the LD_PRELOAD environment variable (DYLD_INSERT_LIBRARIES on Mac). On Unix systems, if the LD_PRELOAD environment variable is set, the dynamic linker loads the specified dynamic library before any others, including libc. Proxychains creates a dynamic library called libproxychains4.so, which overrides functions like connect, close, and sendto. Data sent through these functions is routed through the proxy. For detailed code, refer to libproxychains.c.
Iâve previously explored the LD_PRELOAD hijacking trick in a separate study.