How to configure squid proxy server for Beginners

0
549

squid proxy server

A proxy server is a device that usually sits between a client and the destination the user is trying to reach. It can provide security, anonymity, and even protection for the client behind the proxy. To help in this process is Squid, which is a web proxy server for Red Hat. It sits between the client and web server that the user is trying to connect to. Many times these devices are used when you want to control access to the Internet (think web filtering). As a web proxy, it can also cache data that users request from the Web and make it locally available, reducing the load on your external devices such as gateways and firewalls.

squid-proxy-server

A Squid proxy server is generally installed on a separate server than the Web server with the original files. Squid works by tracking object use over the network. Squid will initially act as an intermediary, simply passing the client’s request on to the server and saving a copy of the requested object. If the same client or multiple clients request the same object before it expires from Squid’s cache, Squid can then immediately serve it, accelerating the download and saving bandwidth.

Installing Squid

we need to start by installing the package(s) needed for Squid. There is only one package required to install the Squid proxy server.

Install the package with the following command:

# yum install -y squid

After it’s installed, verify:

# rpm -qa | grep squid
squid-3.1.4-1.el6.x86_64

Next, you should start Squid service. You use the following command to do this.
Start the Squid service:

# service squid start
      or
#systemctl start squid

Enable Squid to start at boot:

# chkconfig squid on
        Or
#systemctl enable squid

Verify the service will start at boot:

# chkconfig squid —list

squid 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Configuring the Proxy
When setting up your proxy server, you need to know the about the following files

/etc/sysconfig/squid                    Startup options for the config file

/etc/squid/squid.conf                   Main config file for the service

/var/spool/squid                          Cache location on the proxy server

/var/log/squid                              Log files for the proxy server

1.open /etc/squid/squid.conf for editing

squid-file-open
2. Give line numbering by using the command :set nu
3. Go to Line number 62 check port number 3128
clear if # is there at beginning of the line

port-no-3128
4. Check Port Number 3128 is Active or not By using command

netstat -ntlp | grep 3128

5. Restart the service by using the following command

#service squid restart

6.Disable the firewall or add the port number

#service iptables stop
           (or)

open etcsysconfigiptables then add the line

-A INPUT -m state –state new -m tcp -p –tcpdport 3128 -j accept

Now Enjoy squid Proxy server in your Network.

Comments

comments