Select Page

Here a short tutorial about how to setup your own proxies with 3proxy.

The tutorial assumes that you know how to use a ssh client, and that you know how to use it to setup a session to your vps. It also assumes that you already made a vps, received the main ip, some extra ip’s, and the root password to login.

On your vps you have to install Ubuntu 16.04. So not 14.04, Debian or something else. Please note that there is a big difference in for example the networking setup of Ubuntu 14.04 and 16.04. I am always willing to help, but if you install something else than Ubuntu 16.04 you will be on your own…

The server I will setup has 3 ip’s. The main one is 000.000.000.000 and the 2 extra ip’s are 111.111.111.111 and 222.222.222.222.

-login to your vps with ssh.

-change your password with the command:

passwd

-update your software with the commands:

apt-get update
apt-get upgrade

-install an editor. I love joe.

apt-get install joe

-Now we are going to setup the networking part. This involves editing the file /etc/network/interfaces. First we will make a backup of the original interfaces file:

cp /etc/network/interfaces /etc/network/interfaces-saved

Open the interfaces file in the editor;

joe /etc/network/interfaces

Empty the file completely. With joe you can use CTRL-Y to delete lines.

copy/paste this into your interfaces file (ofcourse without the —– lines):

———————————
# The loopback network interface
auto lo
iface lo inet loopback

auto ens3
iface ens3 inet dhcp

iface ens3 inet6 auto

iface ens3 inet static
address 111.111.111.111/24

iface ens3 inet static
address 222.222.222.222/24
——————————-

The above configuration will setup your main IP (is not mentioned but taken care of in the auto, dhcp part) and 2 extra ip’s 111.111.111.111 and 222.222.222.222

Ofcourse you will have to change this to your own ip’s. Do not forget the /24 at the end. If you have more than 2 extra ip’s you can add them. Just copy 2 lines for each extra ip and change it to your needs.

The most often made mistake: Some people try to put their main ip also in this file. Forget this ip. The main ip is setup by dhcp, and you do not have to specify it here!

Save your file with CTRL-K X. It will say; “File /something saved”.
We will restart networking so it will load your new config file:

sudo /etc/init.d/networking restart

To install the other software we need to enter the commands:

apt-get -y install fail2ban software-properties-common
apt-get install build-essential libevent-dev libssl-dev
cd /etc
wget https://gettraffic.pro/docs/3proxy-0.8.11.tar.gz
tar zxvf 3proxy-0.8.11.tar.gz
mv 3proxy-0.8.11 3proxy
cd 3proxy

We have to edit proxy.h with the command;

joe src/proxy.h

Here we add the line:

#define ANONYMOUS 1

You can put it above the other lines starting with #define
Save your file with CTRL-K X. It will say; “File /something saved”.

Compile and install the software:

make -f Makefile.Linux
make -f Makefile.Linux install

Download 3proxy.cfg

wget https://gettraffic.pro/docs/3proxy.cfg

We have to edit 3proxy.cfg:

joe 3proxy.cfg

Change the line;

users root:CL:passwd

Where you replace the word passwd with the password you want to use for your proxies. This can be another password than the password you use for logging into your vps.

This will be the setup for a proxy server with the main ip 000.000.000.000 and 2 extra ip’s 111.111.111.111 and 222.222.222.222. These IP’s you configure in the last part;

proxy -p3128 -a -i000.000.000.000 -e000.000.000.000
proxy -p3129 -a -i111.111.111.111 -e111.111.111.111
proxy -p3130 -a -i222.222.222.222 -e222.222.222.222

Replace the 000.000.000.000 with the main IP, the 111…. and 222… with your other IP’s. For every IP you have you can add an extra line.

These lines also configures the port to use, 3128. If you know what you are doing you can change it to something else. It also specifies the nameservers. I used public ones from OpenDNS in my example. Some providers have their own nameservers you can use.

Save your file with CTRL-K X. It will say; “File /something saved”.

change the rights of 3proxy.cfg with the command:

chmod 700 3proxy.cfg

Setup/Download the other config files:

cd /etc/3proxy/scripts/rc.d/
mv proxy.sh saved-proxy.sh
wget https://gettraffic.pro/docs/proxy.sh

Now we can start our proxy server with the command:

sh /etc/3proxy/scripts/rc.d/proxy.sh start

It should give the output “Starting 3Proxy”. If it doesn’t then there is a problem somewhere in your config files.

Let’s add it to autorun, so after a reboot of your vps it will run by itself:

joe /etc/rc.local

and add line:

sh /etc/3proxy/scripts/rc.d/proxy.sh start

This line has to be added above the line “exit 0”.

Save your file with CTRL-K X. It will say; “File /something saved”.

The best way to check if everything is allright is by doing a full reboot of your vps and checking if everything still works after the reboot.:

shutdown -r now

The maintenance for your server is very simple. Every month or so login and update your software with the commands:

apt-get update
apt-get upgrade

And that is it!

When using your proxies do not forget your port. Often you have to use the format: 111.111.111.111:3128. And ofcourse you will also need your loginname root and the password specified in 3proxy.cfg

Troubleshooting:

-If the above doesn’t work you can test your ip’s by doing a ping to these ip’s from your home computer. If they do not work than there are several possible problems. The first is that you did something wrong in the network setup (file /etc/network/interfaces). The second one, often seen at ovh is that they configured routing wrong. There is no need to look at the configuration of 3proxy if your ip’s don’t work and do not respond to a ping.

-You can find the logfile of 3proxy at /var/log/3proxy.log


A couple of additions (on request)

It is also possible to give several users access to the proxies you made. First you add several users:

users john:CL:topsecret
users mike:CL:anotherpassword
users karl:CL:secretpasswd

Specify which users have access to which services. Start with the authentication method (user/passwd) and end the block with “flush”.

auth strong
allow john
proxy -p3200 -a -i46.4.67.200 -e46.4.67.210
flush

auth strong
allow mike
proxy -p3201 -a -i46.4.67.200 -e46.4.67.211
proxy -p3202 -a -i46.4.67.200 -e46.4.67.212
flush

auth strong
allow karl
proxy -p3203 -a -i46.4.67.200 -e46.4.67.213
flush

This way all users will have access to only their own proxies.

It is also possible to use IP authentication:

auth iponly
allow * 192.168.178.87/24
proxy -p3200 -a -i46.4.67.200 -e46.4.67.210
proxy -p3201 -a -i46.4.67.200 -e46.4.67.211
flush

This will allow IP 192.168.178.87 to access the proxies with port number 3200 and 3201.