Introduction: Squid is a popular and widely-used open-source proxy server that can be used to cache content and improve overall network performance. It also enables you to manage network bandwidth, access control, and set up private connections for added privacy and security. In this tutorial, we’ll guide you through the process of setting up Squid Proxy on Ubuntu 20.04 for private connections.
Step 1: Update and Upgrade Your System Before installing Squid Proxy, ensure that your Ubuntu system is up to date. Run the following commands to update the package list and upgrade the system:
sudo apt-get update sudo apt-get upgrade
Step 2: Install Squid Proxy To install Squid Proxy, run the following command:
sudo apt-get install squid
Once the installation is complete, the Squid service will start automatically. To verify its status, run:
sudo systemctl status squid
Step 3: Configure Squid Proxy for Private Connections To set up a private connection, you need to configure the Squid configuration file. Open the file using your preferred text editor:
sudo nano /etc/squid/squid.conf
Make the following changes to the configuration file:
- Look for the line that starts with “http_port” and change it to the following:
http_port 3128 intercept
This sets the default listening port to 3128.
- Add the following lines to set up access control:
acl private_network src <Your_Private_IP_Range> http_access allow private_network
Replace “<Your_Private_IP_Range>” with your own private IP range (e.g., 192.168.1.0/24).
- To set up authentication, first install the Apache2-utils package:
sudo apt-get install apache2-utils
Next, create a new password file and add a user:
sudo htpasswd -c /etc/squid/passwd <Your_Username>
Replace “<Your_Username>” with your desired username. You’ll be prompted to enter a password.
- Add the following lines to the configuration file to enable authentication:
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd auth_param basic children 5 auth_param basic realm Squid Basic Authentication auth_param basic credentialsttl 2 hours acl auth_users proxy_auth REQUIRED http_access allow auth_users
- Save and exit the configuration file.
Step 4: Restart Squid Proxy To apply the changes, restart the Squid Proxy service:
sudo systemctl restart squid
Step 5: Configure Your Client to Use the Proxy Now that your Squid Proxy server is set up, you need to configure your clients to use it. To do this, configure the proxy settings in your client’s network settings or web browser, using your Squid Proxy server’s IP address and port (3128).
Conclusion: You have successfully set up Squid Proxy for private connections on Ubuntu 20.04. You can now use it to manage network bandwidth, access control, and maintain privacy while browsing the internet.