squid 2.6 transparent proxy
In case you used squid 2.5 to create a transparent proxy and you decided to switch to 2.6 or this is the first time you try to set up a transparent proxy and most/all of the tutorials out there are for squid 2.5 here is a brief howto for this setup.
In squid 2.6 the configuration options:
are not defined anymore ( see squid 2.6 release notes ), so if you are using them in your config file squid will give you an error like "parseConfigFile: line 41 unrecognized: 'httpd_accel_host virtual'" and will refuse to start.
To activate transparent proxy in squid 2.6 all you have to do is use the "tranparent" option on http_port. Something like:
http_port 3128 transparent
Of course squid has to be compiled with transparent proxy support for netfilter (iptables) by adding --enable-linux-netfilter to the ./configure line, the linux kernel needs to be compiled with netfilter and you will also need a rule in iptables that will redirect packets from your local network interface with a destination port 80 to the port squid is listening on.
Assuming your local network interface is eth1 and squid listens on port 3128 here is the rule that has to be added to iptables:
iptables -A PREROUTING -i "eth1" -p tcp –dport 80 -j REDIRECT –to-port 3128