Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to setup a proxy server but I am unable to do it. Here is the details of my setup

I have one Server(IBM X3800 series) and one Desktop PC. Server is having to network card connected to it. eth0 and eth1. eth0 is connected to WAN via global IP of 202 series and internet is working fine on server, I can connect to internet. eth1 is connected to switch and below is config in eth1

Network: 192.1968.2.0

I have simply installed the squid proxy using apt-get install squid. I have changed the file


and added the below details

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
acl lan src
http_access allow lan

and finally added these iptable rules

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to globalip:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

where globalip is the IP of eth0.

Now the desktop PC is connected to server via switch and the ip configuration for Desktop pc is this

Netmaskapt-get install squid:
Network: 192.1968.2.0

I can easily ping from desktop to server and from server to desktop. But my desktop system cannot access the internet. So I guess that the problem is with the squid. Please help me to solve this issue. If you need any other information then please let me know.


share|improve this question
up vote 1 down vote accepted

It looks like you are setting up a transparent proxy but your config does not look valid for this task. httpd_accel_* directives are for reverse proxying (AKA http acceleration) I believe. You should comment them out. Use http_port 3128 transparent instead.

share|improve this answer
I did that, but its still not working ? if you want any other information from my side, please let me know. – HSS Aug 27 '11 at 4:55
Does squid show any error page in a browser? What is an error, can users see anything at all in their browsers? – Alex Aug 27 '11 at 13:10
I cant even connect to internet. I cant ping or via terminal. – HSS Aug 27 '11 at 14:20
It looks like routing is not set up on a server properly, this is not directly related to squid configuration. But you should be able to use squid even without routing enabled. I suggest you to try to configure squid in non-transparent, explicit mode first. You should change http_port 3128 transparent to http_port 3128 and set up as a proxy in browser settings. – Alex Aug 27 '11 at 14:29
Oh I just realized that your transparent proxy was not on your gateway. Your gateway seems to be and your proxy is Your desktop PC clients can't work if the transparent proxy is not on your gateway. By the way, can you access the internet from a server with the squid proxy? – Alex Aug 27 '11 at 14:31

You have a proxy sitting on a computer, but no configuration of any kind to cause other computers to use that proxy. The iptables settings are trying to modify packets that will never wind up on that computer because no configuration anywhere else on your network steers these packets to that computer.

The proxy only proxies HTTP, yet you are still expecting things like ping to work.

It sounds like what you want is NAT, not proxying. And the NAT should be set up on the machine that's the default gateway for the LAN machines.

share|improve this answer
My issue has been resolved, thanks for answering though. – HSS Aug 28 '11 at 10:25

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.