SQUID SERVER
Squid is a caching and forwarding HTTP web proxy. It has a wide variety of uses, including speeding up a web server by caching repeated requests, caching web, DNS and other computer network lookups for a group of people sharing network resources, and aiding security by filtering traffic
In this configuration we are going to learn network proxy ,time block eg weekdays ,sites block
Step 1:
installing squid# yum install squid
edit the configuration file as we mentioned below.
# vim /etc/squid/squid.conf
(add below line after #RFC 4291 link-local (directly plugged) machines this line)
acl locallab src 192.168.1.0/24
make sure that highlighted part is same as in your means it must be /24 not /16 or you can comment highlighted part also
(now we have to put below line after # from where browsing should be allowed
http_access allow localnet
http_access allow localhost)
http_access allow locallab
http_port 8080 now save conf file
Step 2:
restart the services
# systemctl start squid# iptables -F
Client side
now we have to set our ip address in client browsers proxy setting and it should work. port should be 8080 in client alsoThats it we configured the squid serve, if the client brouse any thing that traffic will pass through the squid server
How to set time like weekdays or for normal day ?
NOTE: Thursday-HSaturday-A all other is defaults
edit the configuration file for allowing the locallab network
#vim /etc/squid/squid.conf
(and add line after acl locallab src 192.168.1.0/24)
acl weekdaays time M T W H F 9:30-18:30
now overwrite (delete this line )http_access allow locallab
add these lines
http_access allow locallab weekdays
now save conf file and verify this on client
How to block website ?
First create the file that will store the blacklisted sites.# touch /etc/squid/blacklisted_sites.acl
now add the some sits to block.as mentioned below
# vi /etc/squid/blacklisted_sites.acl
You can add some domains you wish to block like -
.google.com
.facebook.com
(dont write www)
now save the file and again edit squid configure
# vim /etc/squid/squid.conf
(just after the ports ACLs add the following two lines:)
acl bad_urls dstdomain "/etc/squid/blacklisted_sites.acl"
http_access deny bad_urls
save file and try to check in client system
Thats it we configure the squid server, blocking the websits , time !
Comments
Post a Comment