Transparent SQUID Proxy

Here I will show you how to configure SQUID as a transparent proxy server, which means that once the SQUID server is running, you don’t have to configure proxy server IP address on your individual browsers on your client systems. This is something that i forgot to mention in my previous two posts on SQUID – SQUID (Caching Proxy Server) Logs and SQUID ACLs

We all use more than one browser on our system nowadays and with the typical setup, you have to configure SQUID server IP on individual browsers so that all the request pass through the SQUID proxy server. A better way is to configure SQUID server to act as a transparent proxy server and update the client machine’s gateway to use SQUID server’s IP address. That way you don’t have to update proxy server’s IP address on all the browsers that you use on your system.

This is a 3 step process once SQUID is configured:

1. Edit http_port 3128 as below:

http_port transparent

2. Now update firewall rules so all the requests on port 80 gets redirected to port 3128 as follows:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

3. Now, set the gateway on all your client machine to the IP address of your SQUID proxy server.

That’s it. Now, all requests on your client machines will be routed via SQUID server no matter how many different browsers you use.