Technology and troubleshooting.

Tuesday, April 26, 2016

Linux: Configure transparent proxy with squid

In this tutorial I am going to show you how to configure transparent proxy with Squid.
Squid proxy server

My Scenario:- Our management team asked me to monitor the Internet usage for those who are all using internet inside the office premises. So that, we needs to be monitor and report whey they are doing on the internet..

I got a chance to configure the Squid transparent proxy and my task is simple to setup Squid proxy as transparent server.

My Squid transparent Proxy Setup:- 
i) VMWare ESXi 5.5 Dell Server| Processor 1 Core | RAM 1 GB
ii) Static IP Address
iii) Centos 6.7 (CentOS release 6.7 (Final)
iv) Squid Cache: Version 3.1.23

Let me move on to the Squid transparent proxy configuration part:-

Step #1: Turn off the Linux firewall by using the below the command.
[root@Techproxy ~]# service iptables status [Current status of iptables]
[root@Techproxy ~]# service iptables save [save iptables configuration]
[root@Techproxy ~]# service iptables stop [Stop iptables]
[root@Techproxy ~]# chkconfig iptables off [Stop iptables during run-level or system reboot]
                                       (OR)
Configure iptables to allow squid port 3128

iptables -A INPUT -p tcp -s 0/0 –sport 1024:65535 -d 202.54.1.20 –dport 3128 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.1.11 –sport 3128 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT


Step #2: Install Squid Cache.
[root@Techproxy squid]# yum install squid

Step #3: Once the installation is completed make sure your squid service is running.
  • Squid service status
[root@Techproxy ~]# service squid status 
squid is stopped
Squid service is not started yet to start Squid service please use the below command.
[root@Techproxy ~]# service squid start
Starting squid: .                                          [  OK  ]
                             (OR)
[root@Techproxy ~]# service squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]

By default Squid Cache: Version 3.1.23 act as transparent proxy We need not do anything in the configuration part :)

That's it squid transparent proxy configuration part is completed.

Test Squid transparent proxy via telnet 

telnet 192.168.1.11 3128

If you are able to see above black screen we have a connectivity with squid proxy server

Configure squid proxy through client machine.

Tools->Internet Options->Connections Tab-> LAN Settings->Proxy server->Fill Address: & Port information



















Real time monitoring the Squid transparent proxy kindly use the below command .
[root@Techproxy squid]# tail -f /var/log/squid/access.log

I hope this information is useful for you. Please forgive any typos or incomplete sentences.

Share:

0 comments:

Post a Comment

Contributors

Popular Posts