Web Cache Coordination Protocol

Cisco protocol, used for managing transparent distribution of http requests among cache servers, such as squid. Version 1 is old and common, allowing several caches to be used by one router. Version 2 allows several routers to use several caches, and also allows for server / router password authentication.

Benefits of using wccp
Unlike other transparent caching techniques, such as policy redirection (eq. with iptables or ipfw, wccp will stop sending requests to a cache if the cache stops responding. This is nice. The other main method of transparent caching is the use of high layer switches, such as foundries, but these are pricey.

Setting it up
Start with:
1. A Cisco router
2. A FreeBSD 4.9 machine
3. squid built from ports on the server

On the router:
(the following assumes s0/1 is the external, internet facing interface. Also, the loopback must have an IP address.)
ip wccp version 1
ip wccp web-cache
int s0/1
ip wccp web-cache redirect out

You can see the process of wccp with:
sh ip wccp web-cache
debug ip wccp event
debug ip wccp packet
term mon

On the server:
Set up a gre tunnel ($SERVERIP and $ROUTERIP are the interface addresses):
/sbin/ifconfig gre0 create
/sbin/ifconfig gre0 $SERVERIP 1.2.3.4 netmask 255.255.255.255 link1 tunnel $SERVERIP $ROUTERIP up

Edit squid.conf:
wccp_router $ROUTERIP
wccp_version 4
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_single_host off
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

That's it.