Squid transparent proxy in Ubuntu 8.04


Squid is the defacto proxy system. Either in the lab or at home I use a transparent squid proxy in order to have a global cache system for all my devices (I really hate browser caches that take all you disk space).

For years now, in order to configure a transparent Squid proxy you had to put in the following lines:

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

plus the complimentary iptables rules in your router:

iptables -t nat -A PREROUTING -i ethLAN -p tcp -m tcp --dport 80 -j DNAT --to-destination SquidProxy:3128
iptables -t nat -A PREROUTING -i ethWAN -p tcp -m tcp –dport 80 -j REDIRECT --to-ports 3128

But Squid 2.6, which comes in Ubuntu 8.04 (Hardy) no longer supports these and the former 4 lines can be substituted by:

http_port 3128 transparent

written by Diogo Gomes