To configure Squid3 proxy on Ubuntu 20.04, you can follow these steps:
- Install Squid3 using the following command:
sudo apt-get install squid3
- After the installation is complete, open the Squid configuration file using your preferred text editor. For example:
sudo nano /etc/squid/squid.conf
- Locate the
http_port
directive in the configuration file, and specify the port number that Squid will listen on. By default, Squid listens on port 3128. - Locate the
acl
directives in the configuration file, and define the network access controls for your Squid proxy. For example, you can allow access to your Squid proxy only from specific IP addresses or networks:
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
- Locate the
http_access
directive in the configuration file, and specify which users or networks are allowed or denied access to your Squid proxy. For example, you can allow access to your Squid proxy only from the IP addresses or networks defined in the previous step:
http_access allow localnet
http_access deny all
- Save the changes to the configuration file and exit the text editor.
- Restart the Squid service to apply the changes:
sudo systemctl restart squid
- To verify that Squid is running and listening on the correct port, use the following command:
sudo netstat -tulpn | grep squid
This should display the Squid process and the port number it is listening on.
You can now use your Squid proxy to route traffic for your network. Keep in mind that you may need to configure your network settings to use the Squid proxy.
To test if the configured proxy is working use the curl command as follows:
curl –proxy [proxy server]:[port] [URL]
For example:
curl --proxy localhost:3128 https://www.google.com/
If the proxy is working properly, you should see the contents of the website in the terminal.