How to create multiple proxies using IPv4 via Squid
Introduce
Once you have created a proxy via Squid. You want to create multiple different proxies over IPv4 at the same time. In this article, we will guide you to create multiple proxies with scripts through Squid proxy
Prerequisites
To complete this guide, you will need:
Auto install Squid 3 proxy on following linux OS.
In this article we will guide you through installing Ubuntu 20.04
Install Squid
To install, run the script
wget https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid3-install.sh -O squid3-install.sh
bash squid3-install.sh
You can refer to the following Squid installation instructions:
https://green.cloud/docs/how-to-set-up-squid-proxy-for-private-connections-on-ubuntu-20-04/
Create Users
To create users, run
squid-add-user
OR run following commands
sudo /usr/bin/htpasswd -b -c /etc/squid/passwd USERNAME_HERE PASSWORD_HERE
To update password for am existing user, run
sudo /usr/bin/htpasswd /etc/squid/passwd USERNAME_HERE
replace USERNAME_HERE and PASSWORD_HERE with your desired user name and password.
Reload squid proxy
systemctl reload squid
Configure Multiple IP Address
NOTE: This is only needed if you have more than one IP on your server.
Before you can configure squid to use muliple IP address, you need to add IP to your server and you should be able to connect to server using these IPs.
Once IP added to your server, you can configure it to use with squid proxy by running following command
wget https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid-conf-ip.sh
bash squid-conf-ip.sh
Use this command to see if the Proxy has created a Proxy: nano /etc/squid/squid.conf
Change Squid Proxy Port
Squid proxy server runs on port 3128 by default. Changing squid proxy server port to a non-standard port is a good idea as it will protect your proxy server from abusers and hackers.
Method 1
You can use the sed command to replace the port number
sed -i 's/^http_port.*$/http_port NEW_PORT_HERE/g' /etc/squid/squid.conf
In the above command, replace NEW_PORT_HERE with the port number you need.
For example, to run squid proxy on port 5555, run
sed -i 's/^http_port.*$/http_port 5555/g' /etc/squid/squid.conf
Now restart Squid Proxy server
systemctl restart squid
If you have a firewall, you will need to open the port in the firewall.
Method 2: Manual Configuration Change
Edit Squid configuration file with vi or nano editor.
nano /etc/squid/squid.conf
In the file, find http_port, it should look like
http_port 3128
Change 3128 to whatever port number you like. Save and exit the editor.
Restart Squid Proxy server with the command
systemctl restart squid
Test Proxy Server
You can test the proxy via: https://myproxychecker.com/
Enter information by : IP_proxy:port:user_proxy:password