Learn how to configure squid proxy server in Centos 6

Squid is a free proxy server that supports the network protocols you may need for a worry free Internet experience, including HTTP, HTTPS, FTP over HTTP, or Gopher. Want to learn how to configure squid proxy server in Centos 6? With ease.

If you want to set up Squid on your Linux box, proceed as follows. For example, your system has two Network Interfaces, these are 10.0.0.1/8 (eth0), which connects to the Internet via a router, and 192.168.10.1/24 (eth1) which connects to the internal network.

The firewall is configured so, that all ports of the interface eth0 are closed, and TCP port 3128 on the eth1 interface is opened for Squid. Please check necessarily whether the name resolution and access to the WWW work on all the future proxy servers.

Since you run a large number of servers (primarily in the development/test domains) and consequently have to manage a certain number of IP addresses, it was clear, that you could consolidate these by installing proxy server.

When it comes to surfing anonymously, you can hide your IP quite well with the Hola Unblocker, and make occasional purchases under circumvent restrictions on certain regions such as the USA or Brazil.

Benefits

If you already run server or virtual server that have a fast enough connection (which should be really easy to set up these days – in particular from 100+ Mbit/s – to be able to even watch movies through a proxy), you will come to the idea, that adding of sufficient traffic permission to the connection speed is an option – in order to have the ability to enjoy the hidden server’s identity.

Here we show you how an anonymous proxy can be placed and how you can authenticate yourself – from anywhere in the world, just via login.

Squid Installation

Setting up Squid proxy means that you have to define necessary iptables rules. Proceed as follows:

# iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

# iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3128

A transparent proxy based on Squid is up and running when you define the LAN subnet (eg 10.10.10.0/24) as a valid client network. Any traffic originating from the other subnet than LAN will be denied access. When you are ready, start Squid service and make sure you have added it to “Start Up Applications”

# service squid start

# chkconfig squid on

And subsequently you will install squid3 and, if needed, for htpasswd the http-utils:

apt-get install squid3

apt-get install http-utils

Now we can register for a user proxy user password in the password file.

htpasswd -bc squid_passwd proxyuser

We need more users, you have to look at the options of htpasswd even more accurate, omit the c. Whether that will b really needed, I do not know – especially since here the number of characters in the password to 8 is limited, which reduces the security.

Now we can secure the squid.conf (z. B. copy or move), I moved it because that file is still extremely long, and can so easily lose track.

Then you code:

nano /etc/squid3/squid.conf

and copy and paste the text below (paste it in Putty with the right mouse button) the Squid config file.

Voila. Now you are ready to rock. But before you launch your Squid Server, make a test run and check the log file thereafter:

# tailf /var/log/squid/access.log

According to the log, the machine with IP 10.10.10.10 has successfully reached for the google.com, and you newly installed server has processed the request as expected, which means that the most basic form of Squid proxy server is now up and running on your Centos 6 PC.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...