Skip to contentSkip to conversation

transparent proxy

DISCUSSION Tomasz Macioszek 5 participants 6 messages Feb 27, 2004

lore
Share & tools
lore
#0 lore raw

Hello!
I have a Linux server acting as a gateway between internal network and internet. The iptables rule set have been working good for long time. I have configured squid on this server. When I have set internal network client to use directly proxy server it has worked properly. But when I have set iptable to redirect all http traffic to squid port (3128) it didn't work (transparent proxy).
This is my iptable rule:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128 I think that all options in my kernel are set properly.
I don't know why it doesn't work
I set tcpdump to listen on 3128 port and when client tried to connect to web server on port 3128 showed only first IP package of this connection and connections failed.
Could you send me a solution for this problem?
Best regards
Tomek

#1 lore raw

Hi,

you cannot send http traffic directly to a proxy port, these are two different protocols (you also configure your client to use proxy or direct connection).

So, you either configure a proxy, use nat for traffic to port 80 (without using the proxy), or configure squid to listen to another port in "http accelerator mode", the last option is what you seem to want.

Good luck,
Jeroen.

Quoted 19 lines · On Fri, 27 Feb 2004 09:48:39 +0100 "Tomasz Macioszek" <[email protected]> wrote:

Hello!
I have a Linux server acting as a gateway between internal network and internet. The iptables rule set have been working good for long time. I have configured squid on this server. When I have set internal network client to use directly proxy server it has worked properly. But when I have set iptable to redirect all http traffic to squid port (3128) it didn't work (transparent proxy).
This is my iptable rule:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128 I think that all options in my kernel are set properly.
I don't know why it doesn't work
I set tcpdump to listen on 3128 port and when client tried to connect to web server on port 3128 showed only first IP package of this connection and connections failed.
Could you send me a solution for this problem?
Best regards
Tomek

#3 lore raw

Ojee,

that means I'm living in the past, sorry.

Quoted 21 lines · On Fri, 27 Feb 2004 09:27:19 +0000 Antony Stone <[email protected]>…
Quoted 3 lines · Jeroen Vriesman

Hi,

you cannot send http traffic directly to a proxy port,

Yes you can.

See the example netfilter rule given on the Squid FQ at
http://www.squid-cache.org/Doc/FAQ/FAQ-17.html#ss17.4
and http://en.tldp.org/HOWTO/TransparentProxy-5.html

Antony.

Signature · 4 lines
Ramdisk is not an installation procedure.

                                                     Please reply to the list;
                                                           please don't CC me.
#4 lore raw
In reply to Tomasz Macioszek
Quoted 9 lines · Tomasz Macioszek

Hello!
I have a Linux server acting as a gateway between internal network and internet. The iptables rule set have been working good for long time. I have configured squid on this server. When I have set internal network client to use directly proxy server it has worked properly. But when I have set iptable to redirect all http traffic to squid port (3128) it didn't work (transparent proxy).
This is my iptable rule:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128

Quoted 8 lines

I think that all options in my kernel are set properly.
I don't know why it doesn't work
I set tcpdump to listen on 3128 port and when client tried to connect to web server on port 3128 showed only first IP package of this connection and connections failed.
Could you send me a solution for this problem?
Best regards
Tomek

It has been a while since I set up Squid but I would suggest looking in a few areas.

Do you really want to redirect all traffic on port 80 or just the traffic coming in from the internal interface?

Have you allowed traffic to pass on the loopback interface?

I do not recall if one needs to allow traffic to port 3128 on the INPUT chain.

Signature · 9 lines
John A. Sullivan III
Chief Technology Officer
Nexus Management
+1 207-985-7880
[email protected]
---
If you are interested in helping to develop a GPL enterprise class
VPN/Firewall/Security device management console, please visit
http://iscs.sourceforge.net 
#5 lore raw
In reply to Tomasz Macioszek

That rule should work fine, make sure you compiled squid with:

./configure --enable-linux-netfilter

But for more usefull info :)
Here is a nice HOW-TO
http://en.tldp.org/HOWTO/TransparentProxy.html

Quoted 17 lines · Tomasz Macioszek

Hello!
I have a Linux server acting as a gateway between internal network and internet. The iptables rule set have been working good for long time. I have configured squid on this server. When I have set internal network client to use directly proxy server it has worked properly. But when I have set iptable to redirect all http traffic to squid port (3128) it didn't work (transparent proxy).
This is my iptable rule:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT --to-port 3128 I think that all options in my kernel are set properly.
I don't know why it doesn't work
I set tcpdump to listen on 3128 port and when client tried to connect to web server on port 3128 showed only first IP package of this connection and connections failed.
Could you send me a solution for this problem?
Best regards
Tomek

Signature · 4 lines
_,.-:*"``'*:-.,_,.-:*"``'*:-.,_,.-:*"``'*:-.,_,.-:*"``'*:-.,_,.-:*"``'*:-.,_
Daniel Fairchild - Chief Security Officer | [email protected]
The distance between nothing and infinity is always the same no matter how 
close you get to nothing.