In this tutorial, we will show you how to easily chain Socks5 proxies Using SRelay on Ubuntu 16. Scroll down for more details.
Getting Things Ready
Before setting up a Socks5 proxy chain, you need to make sure that there are multiple proxies and that all proxies are working properly because if one proxy is not functioning, the whole proxy chain will not work and will collapse. In addition, if the connection at one proxy is lost, the whole connection to the remote server will be lost causing mass lag to all the proxies in the chain.
Settings Up Chain Socks5 Proxies on Ubuntu 16
1- Run the command below to install the ProxyChains package which is located in the default repository of Ubuntu 16:
$ sudo apt-get install proxychains
2- Once the package is installed, its configuration file will be located in the ‘/etc/’ directory. You can easily open it by running the following command:
$ sudo vim /etc/proxychains.conf
3- If you are using SOCKS proxy with port 1280, you can replace 9150 with 1280. This can be done by replacing the default proxy settings which can be found at the very bottom of the file with the settings you prefer. You can choose from the following 3 types of proxy chains ( dynamic_chain, strict_chain or random_chain). Run the following command to be able to use the chains:
$ proxychains telnet target_host.com
4- The ‘telnet’ command will then run through your specified proxy settings. In order to update your system by using your proxy setting instead of your LAN , run the command below:
$ sudo proxychains apt-get update
How to Setup SRelay on Ubuntu
Follow the steps below in order to correctly configure SRelay on your Ubunto 16:
1- First, download SRelay from the SRelay Package on sourceforge.net/projects/socks-relay/. Next, run the following command to download SRelay:
$ wget https://downloads.sourceforge.net/project/socks-relay/socks-relay/srelay-0.4.8/srelay-0.4.8b5.tar.gz
2- After downloading the SRelay package, run the command below in order to extract the archived package:
$ tar -zxf srelaye-0.0.2.tar.gz
3- Run the “make” command in order to change your directory to the srelay folder that you have extracted:
$ cd srelay-0.4.8b5/
$ ./configure
4- In this step, you have two options to configure your srelay proxy:
– disable-thread disable pthread feature.
Do not use pthread
– with – libwrap = PATH | yes | no with tcp_wrapper access control.
Do not incorporate access control by TcpWrappers
5- Run the following command to copy the SRelay startup script to ‘/etc/init.d’ directory:
$ sudo cp scripts/rc.srelay /etc/init.d/srelay
6- Go to the ‘init.d’ directory to start the service through the following command:
$ cd /etc/init.d
$ srelay start
7- You must make sure that SRelay service is working properly. This can be done by running the command below:
$ netstat -tlnp
$ ps -ef | grep srelay
8- Now it is time to configure Srelay in order to use it as a SOCKS server or as a relaying socks proxy by running its configuration file using your command line editor as shown below:
$ vim srelay-0.4.8b5/srelay.conf
# dest dest-port next-hop next-port Network_A any socks_A 1080 Network_B any socks_B 1080 Network_C any socks_C 1080
9- You can now start using your srelay service through the following command:
$ srelay -c srelay-0.4.8b5/srelay.conf -r -s
10- If you want to know more about the options available, you can do so by running the ‘srelay -h’command:
$ srelay -h
srelay 0.4.8b5 2010/12/20 (Tomo.M) usage: srelay [options] options: -c file config file -i i/f listen interface IP[:PORT] -J i/f outbound interface name -m num max child/thread -o min idle timeout minutes -p file pid file -a np auth methods n: no, p:pass -u file srelay password file -f run into foreground -r resolve client name in log -s force logging to syslog -t disable threading -b avoid BIND port restriction -g use the same interface for outbound as inbound -I inetd mode -v show version and exit -h show this help and exit