Wednesday, April 1, 2015

squid proxy server configuration in linux step by step

SQUID-Proxy

Squid is a type of network Service to sharing the Internet to users.

Squid widely using open source proxy service.

Squid act as a firewall to block the un-reserved sites and domains in your network. And it works as caching server. That store frequently requested Internet webpage can be downloads locally. So it improves performs of access the Internet.

Packages :   squid

Script : /etc/squid/squid.conf

Services : squid

Port number : 3128

Daemon : squid


Configuration of PROXY SERVER 

It is used to share the internet from one machine to several clients 
Current Proxy server  IP is 192.168.0.20 
GateWay 192.168.0.254
DNS 200.200.200.200
Step 1a ): CHECK IP & HOST ENTRIES 
[root@client ~]# ifconfig 

[root@client ~]# netconfig 

  [ ] Use dynamic IP configuration (BOOTP/DHCP) 

IP address: 192.168.0.20
Netmask: 255.255.255.0
Default gateway (IP): 192.168.0.254
Primary nameserver: 
OK
[root@client ~]# service network restart 
[root@client ~]# ping 192.168.0.0 -b
[root@client ~]# route -nv
[root@client ~]# cat /etc/resolv.conf
200.200.200.200 

# Check Gateway IP 
# Check DNS IP 
[root@client ~]# vi /etc/sysconfig/network
NETWORKING=yes 
HOSTNAME=proxy.zoom.com 
:wq! 
[root@client ~]# vi /etc/hosts 

127.0.0.1 localhost.localdomain   localhost
192.168.0.20 proxy.zoom.com proxy
:wq! 
[root@client ~]# hostname proxy.zoom.com [root@client ~]# hostname 
proxy.zoom.com 

* NOW LOG OFF & LOG IN *
Step 1b) Now Open the Browser & Check Internet is comming on Proxy
Server
Step 2 : CHECK & INSTALL THE PACKAGE
[root@proxy ~]# rpm -qa  squid* 
or 
[root@proxy ~]# yum list installed  squid* 
[root@proxy ~]# yum remove squid* -y 

Now Install the packages 
[root@proxy ~]# yum  install squid* -y 
Step 3) Edit Main Configuration File 
[root@proxy ~]# vi /etc/squid/squid.conf 
# I) To Configure squid as only Simple Proxy i.e Only For sharing 
73 http_port 3128
2831  visible_hostname  ZOOMPROXY 
# II) To Configure squid as Caching Proxy i.e caching website in local harddisk 
993 cache_dir ufs /var/spool/squid 100 16 256 

# III) To Configure squid as Proxy FireWall # syntax for the firewall rule 
# acl aclname acltype string1/file_name 
2517 # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS 
2518 
#################################################################### 
2519 
2520 #create a rule for particular network 
2521 
2522 acl  zoomlinuxnetwork src 192.168.0.0/24
2523 
2524 #create a rule for blocking particular site say www.naukri.com 
2525 
2526 acl jobsite url_regex www.naukri.com
2527
2528 #create a rule for time duration
2529
2530 acl classtime time S M T W H F A
18:30-22:30
2531
2532 # http_access allow all
2533 http_access deny  jobsite
2534 http_access deny  classtime
2535 http_access allow zoomlinuxnetwork
2536
####################################################################
:wq!
Step 4) START THE SERVICE 
[root@proxy ~]# service squid restart 


Client Side Configuration 


For proxy any Browser is a client  i.e a client can be on server or any other machine. 

1) If a client is Firefox 
Open Firefox 
-> Edit 
-> Preference 
-> General 
-> Connection Setting
->Manual Proxy configuration
->HTTP Proxy 192.168.0.X
Port 3128
Where X is the proxy servers IP 
Now type the website names in locationbar 
2) If a client is Internet Explorer 
Open Internet Explorer 
Tools 
->Internet Options 
->Connections 
-> LAN Setting 
->Proxy Server 
-> Address 192.168.0.X
Port 3128
























No comments:

Post a Comment