Saturday, August 20, 2016

Squid - Basics

SQUID is a caching and web proxy. A proxy server can be taught of a intermediary layer between PC or device and the internet. This server makes the requests to the internet on behalf of us. That is we don’t connect to the internet where as we talk to the proxy server for websites and the proxy server will connect to the internet to get the websites that we requests.

A proxy can be taught of a tool which will forward HTTP requests. Some of the examples of proxy servers include Apache (with mod_proxy or Traffic Server), HAProxyIIS configured as proxy (e.g., with Application Request Routing), NginxPrivoxySquidVarnish(reverse proxy only).

Here are some of the benefits of using a proxy Server,
·         Control Internet Usage
·         Bandwidth Savings & Improved Speed
·         Privacy Benefits: Hide Your IP Address, Location & Other Information
·         Proxy Servers Can Improve Security
·         They Provide Access to Blocked Resources on the Internet
Squid is a caching and forwarding web proxy. It has a wide variety of uses, from speeding up a web server by caching repeated requests; to caching webDNS and other computer network lookups for a group of people sharing network resources, to aiding security by filtering traffic.

In this article we will see how we can configure Squid in CentOS.

1. Install Squid - Use the yum tool or the rpm tool to install the Squid as “yum install squid*”

2. Change the Configuration in the squid configuration file located at /etc/squid/squid.conf.

Un comment the http_port in the configuration file as
http_port 3128

Add a rule for the local host to access http content as
acl client src 172.16.202.95 # Home IP http\_access allow client

Note – Change your IP address in place of 172.16.202.95

3. Once the above changes are done, we need to add entries to the /etc/hosts file with the IP address and hostname as
[root@dev vagrant]# cat /etc/hosts
172.16.202.95          puppet.jas.com                 puppet.jas.com

4. Once the changes are done, start the Proxy as “service squid start”

5. Make the configuration changes to the browser side so that we use our proxy server to access internet

IE : Tools » Internet options »Connections » LAN settings » Choose “Use a proxy server for your LAN” » Type your Proxy server ip (192.168.1.11 ) and port no 3128

Firefox : Options / Preferences » Advanced » Network » Settings » Choose “Manual proxy configuration ” » Type your Proxy server ip (192.168.1.11 ) and port no 3128

6. Browse some sites and check the access log file on proxy server

7. Check the logs at /var/log/squid/access.log

1468581179.398    198 172.16.202.95 TCP_MISS/302 646 GET http://www.google.com/ - HIER_DIRECT/216.58.196.100 text/html
1468581179.782    369 172.16.202.95 TCP_MISS/302 749 GET http://www.google.co.in/? - HIER_DIRECT/216.58.196.99 text/html
1468581182.165   5551 172.16.202.95 TCP_MISS/200 458 GET http://secure.livechatinc.com/licence/4427091/tunnel_callback.cgi? -

We can see that the websites are being accessed from 172.16.202.95 rather than directly connecting to the internet. More to come, Happy learningJ.

No comments :

Post a Comment