Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Can't get this to work at all! I'm trying to get this linux box to act as a transparent proxy and, with the help of DHCP, force everyone on the network to gate into the proxy.

I have two ethernet connections, both to the same switch. And I'm trying to get to become the default gateway.
The actual WAN connection is to a gateway
eth0 is
eth1 is

Effectively I'm trying to make eth0 a LAN only interface and eth1 a WAN interface. I've oi should set the gateway for eth1 to point to

my squid.conf file has the following directives added at the bottom: nly set eth0 to have a gateway address in /etc/network/interfaces I'm not sure whether http_port 3128 transparent acl lan src acl lh src http_access allow lan http_access allow lh

i've added the following routing commands:

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination
iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128

I set a computer with TCP settings as the gateway and opened up, but it comes up with a request error. Any ideas why this isn't working? :( Been searching continuously for a solution to no avail.

----------------------------- EDIT ------------------------------- Managed to get it to route properly to the squid, here's the error I get in the browser:

The requested URL could not be retrieved

While trying to process the request:

GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv: Gecko/20090729 Firefox/3.5.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0

The following error was encountered:

    * Invalid Request 

Some aspect of the HTTP Request is invalid. Possible problems:

    * Missing or unknown request method
    * Missing URL
    * Missing HTTP Identifier (HTTP/1.0)
    * Request is too large
    * Content-Length missing for POST or PUT requests
    * Illegal character in hostname; underscores are not allowed 

Your cache administrator is webmaster.
Generated Mon, 26 Oct 2009 03:41:15 GMT by mjolnir.lloydharrington.local (squid/2.7.STABLE3)
share|improve this question
Giving the actual request error might be a mighty fine start. – womble Oct 26 '09 at 3:32
actually i would have done that but i screwed up the interface config and now it won't even connect at all :( – atomicharri Oct 26 '09 at 3:36

2 Answers 2

Make sure you don't have conflicting port definitions, squid will probably listen on 3128 anyway, so you probably need to modify the existing statement, not add a new one.

Also try manually setting the box as a proxy and make sure it's otherwise working before making it transparent.

share|improve this answer

read this slowly...

share|improve this answer

Your Answer


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.