It is important to System Administrator to keep the bandwidth on equal range. Sometimes user may download the movie/song/software, this will affects the other users bandwidth on same network.
In previous post, we have discussed about the installation and configuration of squid proxy server. Here we are going to see how to block unwanted websites and restrict user to download the files in your network.
Squid Server Details:
IP address: 192.168.1.5
Hostname: server.local
How to check whether the proxy server is running or not
[root@server ~]# /etc/init.d/squid status
If it is not running, execute the below command
[root@server ~]# /etc/init.d/squid start
Step 1: Blocking Websites
[root@server ~]# vi /etc/squid/squid.conf
Search for acl and add below two lines.
acl blocksites dstdomain "/etc/squid/blocksites.squid"
http_access deny blocksites
Save and exit(:wq!)
[root@server ~]# vi /etc/squid/blocksites.squid
Add websites to block on your environment.
For example :
www.gmail.com
www.yahoo.com
www.facebook.com
www.twitter.com
Save and exit(:wq!)
Step 2: Block downloading files
[root@server ~]# vi /etc/squid/squid.conf
Search for acl and add below two lines.
acl blockfiles urlpath_regex "/etc/squid/blockfiles.squid"
http_access deny blockfiles
Save and exit(:wq!)
[root@server ~]# vi /etc/squid/blockfiles.squid
Add the extension to be blocked on your environment.
\.[Ee][Xx][Ee]$
\.[Aa][Vv][Ii}$
\.[Mm][Pp][Gg]$
\.[Mm][Pp][Ee][Gg]$
\.[Mm][Pp]3$
\.[Zz][Ii][Pp]$
\.[Tt][Aa][Rr]$
\.[Ii][Ss][Oo]$
Save and exit(:wq!)
Note:
[Ee][Xx][Ee]$ :- “.exe or .EXE file extension”
[Aa][Vv][Ii}$ :- ".avi or .AVI file extension"
If you would like to deny access for specific words who browses to a URL. Below example will block the internet when user search for job category.
Search for acl and add below two lines.
acl blockurl url_regex -i job
http_access deny blockurl
Restart the squid server to make these changes effective.
[root@server ~]# /ect/init.d/squid restart
or
[root@server ~]# /etc/init.d/squid reload
Close and open client webbrowser to check these changes are working properly.
That’s it… Enjoy 🙂