Super User is a question and answer site for computer enthusiasts and power users. 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 have installed squid3 server on my remote server (ubuntu 12.04), I would like to use it as proxy server. What configurations do I need to make in order to use it from every computer which has internet connection?

share|improve this question
Have you looked at the squid.conf file? It's huge. It explains everything, but there are so many options that nobody is going to tell you exactly what you want. IIRC, the default option for access allows all computers, anyway. – paradroid Aug 15 '12 at 15:06
I installed squid on remote server, then on my local machine changed browser proxy settings to remote server's IP and port 3128 (default squid port), but no result – torayeff Aug 15 '12 at 15:08
You need to look at the acl and http_access options. I've used a few others as well. I'd look out for blogs where people have posted their configs and customise them to suit you. – paradroid Aug 15 '12 at 15:29

There's only one setting I needed to change from the default; the http_port line. From the sounds of it you want to do what I set up; automatically shunt traffic through squid as a transparent proxy. For that, the line should read:

http_port 3128 transparent

I also use dansguardian in my system, so my iptables rules might not work for you, but you'll need to use it to direct traffic coming in off your network through squid and out to the internet. Something like this:

# squid server IP
# Interface connected to Internet
# Interface for
# Dansguardian port

echo "Applying proxy rules for packets routing through $LAN_IN -> $SQUID_SERVER:$DG_PORT"

# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X

iptables -P INPUT DROP

# Unlimited access to loop back
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT

# set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE
iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT

# unlimited access to LAN
iptables -A INPUT -i $LAN_IN -j ACCEPT
iptables -A OUTPUT -o $LAN_IN -j ACCEPT

# port forwarding

# HTTP (example)
iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j DNAT --to
iptables -A INPUT -p tcp -m state --state NEW --dport 80 -i $INTERNET -j ACCEPT

# Divert traffic for external web pages through squid (dansguardian)
iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$DG_PORT
iptables -A OUTPUT -p tcp -o $LAN_IN --dport 80 -j ACCEPT

I have a (more fleshed out) version of this script in my /etc/network/if-up.d/proxyrules. A few tweaks should have you up and running happily.

Another Squid setting you might need to fiddle with is ACLs; allowing people access to your proxy server. Mine does work with the default, but you may need to modify this section to get around a Squid "access denied" error.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .