Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

3 Answers 3

Have you tried to ping 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

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

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

share|improve this answer

I was also receiving the same error but here is how i solved, assign different network to both nic ( network interface card)

Suppose you assign a 192.168.1.Ip to eth0

then you must assign 192.168.2.IP to eth1

YOu can use 192.168.2.ip or any other network other than that is assigned to eth0 that is 192.168.1.IP

& suppose Eth0 is connected to router it must have gateway as the routers ip

& Suppose ETH1 is connected to switch through which the client machines are connected the ip of proxy must be entered in proxy configuration in browser

& also uncommented net.ipv4.ip_forward=1

which is present in /etc/sysctl.conf file save settings & reboot confirm on the server that the ping is received by entering

ping from squid server & check if the internet is working

ping the IP of Eth1 that is the nic which connected from switch to clients pc. ping ip of eht1 from client terminal

Your ip are 2.2 & 2.4 which are in the same network better change the ip of eth1 to 192.168.3.ip or replace the no 3 with any number other than 2 & there is no need to enter gateway in eht1 but the broadcast address also changes suppose you selected 192.168.3.IP for eth1 then the network is & broadcast ip is

Below is my configuration

auto eth0 ( ON board Ethernet port & is connected to ROuter) iface eth0 inet static







auto eth1

( LAN card IS connected to switch & clients are connected to switch)

iface eth0 inet static address






Clients have ip of 192.168.1.IP

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.