This is a discussion on WCCP, GRE redirect target failed: SOLUTION - squid ; Dear All, I have finally succeded in getting SQUID working as a transparent proxy on a Debian Linux box (version 2.6.18) using WCCP from a CISCO router. The solution will follow shortly after I rant just a little bit. RANT: ...
I have finally succeded in getting SQUID working as a
transparent proxy on a Debian Linux box (version 2.6.18) using WCCP
from a CISCO router. The solution will follow shortly after I rant just
a little bit.
I'd like to say it was a carefully reasoned solution as a
result of an improved understading of linux networking. It wasn't. I'd
even be happy to say that it was something stupid I missed early on and
that I am now flailing myself every evening in recompense. It wasn't
that either. In the end - I just tried everything I could possibly
think of in as many combinations as possible until something stuck.
This is the worst kind of brute-force approach and I feel it important
to document my solution somewhere so that other people don't have to go
through this as well.
So I upgraded to linux 2.6.18 as it has support for the
non-standard GRE packets that CISCO uses for WCCP built in (I don't
have to use ip_wccp). I set my SQUID up as per all the helpful FAQs.
I made sure my "ip spoofing protection" was switched off and "ip
forwarding" was switched on by editing /etc/sysctl.conf to say :
net.ipv4.conf.all.rp_filter = 0
I made a GRE tunnel like so
iptunnel add gre1 mode gre remote $routerPublicIP local \
$webCacheIP dev eth0
ifconfig gre1 $greAdapterIP up # greAdapterIP = 127.0.0.2
I checked my rp_filter settings for the gre interface and eth0:
(they should all print out "0")
Then I set up my ipTables as follows:
iptables -A INPUT -i gre1 -j ACCEPT #allow everything in from
iptables -t nat -A PREROUTING -i gre1 -d 0/0 -p tcp --dport 80 -j
DNAT --to-destination $webCacheIP:$webCachePort
# Redirect anything coming in the gre interface to the webcache
proxy on it's proxy port.
Note I used DNAT in stead of REDIRECT. This is because REDIRECT
just didn't work with anything coming out of the GRE tunnel. Honestly.
I can log stuff just before it gets redirected without a problem, but
then the packets just disappear. Vanish. But DNAT does work. That's the
real key. Don't ask me why, but it does. It is the failure of the
REDIRECT target that really caused the problem and no end of headaches.
Two weeks worth of headaches to be exact.
Please refer to my previous post :
I hope this has helped someone. If anyone has an explanation as
to why this works and REDIRECT doesn't, I'd be happy to hear it.