Deploying a Socks5 Proxy¶
Here we provide two methods for installing a Socks5 proxy. To avoid issues, please read the relevant descriptions carefully.
Requiring UDP Protocol Proxying¶
Due to the nature of Socks5 UDP proxying, it can introduce many complications. If you are certain you need to use UDP, you must follow these rules. First, your host system must be Linux, and your firewall must allow UDP traffic on ports 50000-55000. Second, your server's network must not be behind NAT (including FULL NAT; many cloud servers today use NAT mode).
Tip
If you don't know whether your server's network is behind NAT, use a command like ifconfig to get the IP address of the default network interface. Then, from the location where you want to use the proxy, ping this address. If the ping fails, your server is likely behind NAT. Of course, not meeting these conditions doesn't mean you can't use UDP. You can still set up gost yourself; instructions are provided at the end of this document.
Attention
When UDP Proxying is Not Needed¶
If you do not need to proxy the UDP protocol, then everything is much simpler. The following command will start a SOCKS service.
docker run -it --rm -p 1080:1080 --name socks -e LOGIN=username -e PASSWORD=passwd rev1si0n/socks5
Specifying the Outbound Network Interface¶
If your server or computer has multiple internet-accessible interfaces—for example, a home computer connected to two different networks via both an Ethernet cable and Wi-Fi—you might have two network interfaces like wlan0 and eth0. You may want to specify which network the proxy uses for outbound traffic. If you want to use eth0 for outbound traffic, use the following command to start the SOCKS service.
Attention
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, you can use the following command.
docker run -it --rm --net host --name socks -e LOGIN=username -e PASSWORD=passwd rev1si0n/socks5
Using the 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 don't want to install Docker, you can try using gost. Download the compressed executable file for your system from github.com/ginuerzh/gost/releases/.
gost -L=socks5://username:passwd@:1080
Hint