Deploying a Socks5 Proxy

Here we provide two methods for installing Socks5. To avoid issues, please read the descriptions carefully.

Need UDP Protocol Proxy

Due to the characteristics of SOCKS5 UDP proxying, potential complications increase significantly. If you are certain that you need UDP support, you must follow these rules:

  1. Your host system must be Linux, and your firewall must allow UDP ports in the range 50000-55000.

  2. Your server’s network must not be behind NAT (including FULL NAT). Many existing cloud servers operate in NAT mode.

Tip

Why must the host be Linux? Because on other operating systems, Docker may fail to properly map such a large range of ports. Additionally, Docker’s network mode cannot be set to “host” on non-Linux systems.

If you’re unsure whether your server is behind NAT, use commands like ifconfig to obtain the IP address of the default network interface, then try pinging this address from the device where you intend to use the proxy. If the ping fails, your server is likely behind NAT. Of course, even if some conditions aren’t met, it doesn’t necessarily mean UDP won’t work. You can still manually set up GOST—refer to the end of this document for instructions.

Attention

Due to the nature of SOCKS5 UDP proxying, if you require UDP functionality, configure your firewall to allow UDP communication across all ports.

Without UDP Protocol Proxy

If you don’t need UDP protocol proxying, everything becomes simple. Use the following command to start a SOCKS service:

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

Specify Egress Network Interface

If your server or computer has multiple network interfaces capable of accessing the internet—for example, a home PC connected via both Ethernet and Wi-Fi, resulting in two interfaces such as wlan0 and eth0—and you want to specify which interface is used for outbound traffic through the proxy, you can do so. For instance, to use eth0 for egress traffic, start the SOCKS service with the following command:

Attention

Your computer or server must be running a Linux system, as specifying network interfaces is not supported on other operating systems.

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

If you have already met all prerequisites for using UDP, use the following command instead:

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

Using GOST Service

If you need UDP support but cannot meet the above requirements, or don’t need to specify an egress interface, or prefer not to install Docker, consider using GOST.
Download the executable package for your system from github.com/ginuerzh/gost/releases/.

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

Hint

After completing all deployment steps, refer to the “Setting Up Proxies” section to learn how to configure network proxies on your devices.