Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers 2

Have you tried to ping www.google.com? If you don't get a reply there might be a problem with your squid setup or iptables. If you can install bind9 for DNS support. Hope it helps.

share|improve this answer
add comment

Your "gateway" is listed as 192.168.2.1, but you are trying to do a transparent proxy on 192.168.2.2.

Your "server" which has real internet access on eth0 should not be listing a gateway in the configuration for eth1, as that will then give two default gateways, one of which its not clear can even work.

So, remove that default gateway, and set the client PC's default gateway to 192.168.2.2.

share|improve this answer
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.