Deploying Proxy Service¶
Here we provide two methods for installing a SOCKS5 proxy. To avoid issues, please read the relevant descriptions carefully.
If You Need to Proxy UDP Traffic¶
Due to the nature of SOCKS5 UDP proxying, many unexpected issues can arise, and the situation becomes increasingly complex. If you are certain that you need UDP, you must follow these rules: First, your host system must be Linux, and the firewall must open UDP ports 50000-55000; second, your server's network must not be NAT (FULL NAT is also unacceptable, many cloud servers are currently in NAT mode).
Tip
Why must the host be Linux? Because on other systems, Docker may not properly map such a wide range of ports, and the Docker network mode cannot be set to host mode on other systems.
If you are unsure whether your server's network is NAT, use commands such as ifconfig to get the IP address of the default network interface, and then ping this address from the machine where you intend to use the proxy. If the ping fails, your server is likely in a NAT network. Of course, even if some conditions are not met, it does not mean UDP is completely unusable; you can still set up gost yourself, and the specific method will be introduced at the end of the document.
Attention
Due to the nature of SOCKS5 UDP proxying, if you determine that you need UDP, you must configure the firewall to allow UDP communication on all ports.
If You Don't Need to Proxy UDP Traffic¶
If you do not need to proxy UDP, everything is simple. Execute the following command to start a SOCKS5 service.
docker run -it --rm -p 1080:1080 --name socks -e LOGIN=username -e PASSWORD=passwd rev1si0n/socks5
Specifying an Outbound Network Interface¶
If your server or computer has multiple network interfaces with Internet access, for example, a home computer connected to two networks via Ethernet cable and Wi‑Fi, it may have two network interfaces such as wlan0 and eth0. When you want to specify which network interface the proxy uses for outbound traffic, for instance, to go out through eth0, use the following command to start the SOCKS5 service.
Attention
Your computer or server must be running Linux; other systems do not support specifying the outbound network interface.
docker run -it --rm --net host --name socks -e LOGIN=username -e PASSWORD=passwd -e DEV=eth0 rev1si0n/socks5
If you have met all prerequisites for using UDP, just use the following command.
docker run -it --rm --net host --name socks -e LOGIN=username -e PASSWORD=passwd rev1si0n/socks5
Using gost Service¶
If you want to use UDP but cannot meet the conditions mentioned above, or you don't need to specify an outbound interface, or you prefer not to install Docker, you can try gost.
Download the executable archive for your system from github.com/ginuerzh/gost/releases/.
gost -L=socks5://username:passwd@:1080
Hint
After completing all deployment steps, please refer to the Set Proxy chapter to learn how to configure the network proxy for your device.