Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Im trying to route some traffic on my lan.

I have a squid3 server on 192.168.0.1:3128 and all web traffic is going through squid3. (Transparent via iptables) And now I have a testing server up and running havp on 192.168.0.24:3127

Squid3 caches, havp checks for malware and virus

Is there a way to "cut" into traffic before it hits my squid server, and pass i through my havp server? havp is setup up to forward traffic back to 192.168.0.1:3128 (non ssl traffic)

This is the iptables syntax I have tried so far:

iptables -t nat -A PREROUTING -i eth3 -p tcp --dport 80 -j REDIRECT --to-destination 192.168.0.24:3127

And this one:

iptables -t nat -A PREROUTING -i eth3 --dst 192.168.0.24 -p tcp --dport 80 -j REDIRECT --to-port 3127

None of them are working. 192.168.0.24 is setup to accept traffic on port 3127.

If I manually connect to the havp server, It's working like a charm.

My browser -> havp -> squid3 -> internets

What am I doing wrong here?

share|improve this question
add comment

1 Answer 1

Use -I instead of -A

-A appends the rule to the end, -I inserts it at the top. Since you've said it's already acting transparently, you must already have a rule to redirect the traffic to 3128. The first matching rule ends the checks, with your current attempts once the first (original) rule is matched, your second one never gets checked.

A better option is probably to setup havp as a parent proxy to squid.

share|improve this answer
    
Thanks for the feedback. havp is already parent to squid. And havp takes care of the traffic from havp to squid again. But I have no way to send the traffic from 192.168.0.1 -> 192.168.0.24:3127 (havp) –  Andreas Feb 11 '13 at 16:35
    
[look her for diagram] (bildr.no/view/1389674) –  Andreas Feb 11 '13 at 16:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.