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.
Trying to contact you through other means, if you catch my drift? – Can’t get this to execute… only about a third of the way through and hung up on one thing all day!
It should be a very simple thing to do. Max 5 mins 🙂
is it possible to show, how to do ip authentication and bandlimit per ip or per user? Thanks in advance.
I added some examples for different users and IP authentication. Bandwith/limits I never used myself…
Amazing tutorial, it worked like a charm on first try. With me and Linux – that is kinda rare.
I am wondering – do I have to compile 3proxy again when I want to add more IPs? Or would I just add them to interfaces and 3proxy.cfg?
On another note – I get “free” ipv6 addresses from my provider. How would I go about when I wanted to add them too?
Thanks a lot in advance!
To add more IP’s you only have to add them to the interfaces file and 3proxy.cfg.
To make proxies with IPv6 addresses you do something like this:
proxy -p10001 -a -6 -i163.172.143.213 -e1001:0cc8:3c13:100:a646:b21e:972b:cef6
You talk to the proxy using an IPv4 address and port 10001, the outgoing IP is IPv6.
Of course you also have to configure these IPv6 addresses in the interfaces file.
Thank you very much for this tutorial !
Once I have rebooted my vps, I cannot access to my vps via ssh.
I manage to start the 3proxy service via the manager console, but proxy connection is not working too.
Any idea of where it could come from ?
Thanks !
You first have to make sure that you configured your IP’s correctly in the interfaces file. You must be able to ping them from your home computer. And logging into the VPS with SSH should work too. Once you are sure that the IP’s are configured correctly you can try 3proxy. 3proxy will never work if the IP’s do not work.
I always get the joe 3proxy.cfg
emtpy 🙁 help
Hey man how i generate 50 ips?
That is not something you can do yourself…
Hi I am getting a problem. When I try to do: sudo /etc/init.d/networking restart
I get:
error: [….] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code. See “systemctl status networking.service” and “journalctl -xe” for details. failed!
What am I doing wrong? Thanks 🙂
You can also just reboot the VPS. The result will be the same.
No clue where your errors come from…
Hi Dimitri, your guide works well!
My VPS and IP are working good but only if I delete “i” on this:
proxy -p3128 -a -i(THIS)111.111.111.111 -e111.111.111.111
to proxy -p3128 -a -(THIS)111.111.111.111 -e111.111.111.111, why?
And.. If i add a second IP
proxy -p3128 -a -i222.222.222.222 -e222.222.222.222
it doesnt work, with “i” or without.
(Yes, it pings well and edited on 3proxy)
Please help <3
a second IP, a second proxy… You should change the port number from 3128 to 3129 or something like that. You cannot have more than 1 proxy on the same port. So it should be something like this:
proxy -p3129 -a -i222.222.222.222 -e222.222.222.222
Also deleting the -i is not a good idea. If that works you probably made a mistake in the 111.111.111.111 part.
Hello, thanks for the clean tutorial. Is it possible to set this up using Squid?
One thing I don’t understand is how will client connect to the server? Say, right now, I’m able to connect to Squid proxy server using _AMAZON_EC2_IP_ADDRESS:_PORT_NUMBER_
Now if I use this, how does, how do clients connect to the other IP designated in the step “222.222.222.222” ??
Are these “222.222.222.222” actual IP from other VPS which are open to it or they virtually made?
No Squid here. 3proxy rulezzz 🙂
The “222.222.222.222” must be a real IP. It is the IP you use to connect to the proxy, and at the same time it is the IP that is used to send the traffic out. A virtual IP will not work here.
Great tutorial (y)
I have a question about ip when i want to use 2 3g modems. So main ip will be from lan- yes? Second and third will be from 3g dongle – but they are dynamic so should i use there local ip? Can you help?
Best regards
Hello sir
Sir i need ipv6 proxies. But I’m a beginner in servers and coding. So can you please help me. I will pay you please help!
Please reply
Thanks for support
Good day
Hey I have skipped adding the username.How do I add or edit this
Nice tutorial, going to give it a try.
Amazing guide owrking great
thank you so mush
how i configure these proxys to socks5 proxys?
This guide is one of the best guides out there on how to set up 3proxy. This finally allowed me to finish the project I’ve been working on for a few weeks now!
Thank you so much, dimitri!
How can I use multiple 3g dongles(one dongle per user)?The ips of the 3g dongles does change everytime reconnection occurs. How can I setup 3proxy?
I have a 4G Router with a dedicated IP.
Is it possible to use that IP as a proxy if i follow the above steps? Or does the IP need to be configured as a static on the interfaces for this to function?
Hi, thanks for this tutorial. I tried to set things up. And everything is up and working (I can ping my IPs from my computer and I can ping any website from VPS).
But for some reason when I try to reach any address it gives me 502 error.
I also checked the logs file it have 00000 and 00100 error codes. I can’t Figure out why I’m getting that 502 error. Can you suggest me something about this issue.
On https://3proxy.ru/doc/howtoe.html completely at the end you can find the error codes used by 3proxy.
100 is HOST NOT FOUND and is probably caused by a DNS error. Make sure that you specify the DNS servers in 3proxy.cfg
Hello dimitri is there any way to create automatical script for creating users and ipv6/128 subnets with ports?
i mean is it possible to communicate with the ipv4 :user:pass / but the conenction should go to the ipv6
Yes, you can. You can do something like this:
proxy -p1000 -a -6 -i1.2.3.4 -eFE80:0000:0000:0000:0202:B3FF:FE1E:8329
The connections will be accepted on IP 1.2.3.4 with port number 1000, all traffic will go out using FE80:0000:0000:0000:0202:B3FF:FE1E:8329