Deploying Socks5 Proxy

Here we provide two methods for installing socks5. To avoid problems, please read the related descriptions carefully.

Need to Proxy UDP Protocol

Due to the characteristics of socks5 UDP proxy, this will create more and more pitfalls and issues. If you are sure you need to use UDP, you must follow these rules. First: Your host system must be Linux, and the firewall needs to open UDP ports 50000-55000. Second: Your server network must not be NAT (FULL NAT doesn’t work either, many existing cloud servers are in NAT mode).

Tip

Why does the host machine need to be Linux? Because on other systems, docker may not be able to properly map such a large range of ports. Second, on other systems, docker network mode cannot be set to host mode.

If you don’t know whether your server network is NAT or not, please use commands like ifconfig to get the IP address of the default network interface, and then ping this address from where you want to use the proxy. If you cannot ping it, then your server may be in NAT. Of course, if the conditions are not met, it doesn’t mean you can’t use UDP. You can still set up gost yourself, which is introduced at the end of this document.

Attention

Due to the characteristics of SOCKS5 UDP proxy, if you are sure you need UDP, please set the firewall to allow UDP communication on all ports.

No Need to Proxy UDP Protocol

If you don’t need the UDP protocol to be proxied, then everything is simple. The following command can start a SOCKS service:

docker run -it --rm -p 1080:1080 --name socks -e LOGIN=username -e PASSWORD=passwd rev1si0n/socks5

Specify Outbound Network Interface

If your server or computer has multiple interfaces that can connect to the internet, take a home computer as an example, you are connected to two networks through a network cable and WIFI, then your computer may have two network interfaces wlan0, eth0, and you want to specify which network for the proxy to use for outbound traffic. If you want to use eth0 for outbound traffic, you can start the SOCKS service using the following command:

Attention

Your computer or server must be a Linux system. Other systems do not support specifying network interfaces.

docker run -it --rm --net host --name socks -e LOGIN=username -e PASSWORD=passwd -e DEV=eth0 rev1si0n/socks5

If you have met all the prerequisites for using UDP, 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 for using UDP above, or you don’t need to specify an outbound interface, or you don’t want to install docker, you can try gost. Download the executable file package for your system from github.com/ginuerzh/gost/releases/.

gost -L=socks5://username:passwd@:1080

Hint

After completing all deployment operations, please refer to the setting proxy chapter to learn how to set up network proxy for your device.