Squid proxy not working, using Ubuntu Server 10.04 and two NICs. One is connected to WAN and other to LAN

PROXYsquidubuntu-10.04

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

IP: 192.168.2.2
Netmask: 255.255.255.0
Gateway: 192.168.2.1
Network: 192.1968.2.0
Broadcast: 192.168.2.255

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

/etc/squid/squid.conf

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 192.168.2.0/24
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

IP: 192.168.2.4
Netmaskapt-get install squid: 255.255.255.0
Gateway: 192.168.2.1
Network: 192.1968.2.0
Broadcast: 192.168.2.255

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.

Thanks

Best Answer

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.