Proxy Server acts as an intermediate between your local network and Internet.
Proxy servers is used to watch the user’s internet activities, control the bandwidth and block various sites in large industries, or schools or colleges.
Every information sent by local machines goes to proxy server to the internet, and every incoming connection or data comes via Proxy server to a particular machine in the network.
So why install a proxy server?
- Well, You can block certain social networking websites, or other websites you don’t want.
- It gives a daily/weekly/monthly/yearly report of the usage of internet (Light squid).
- It helps you monitor users on your network.
- Blocks websites without valid certificated.
- Proxy server helps you cache websites, thus providing them instantly.
- Provides security to the network from Intrusions.
- Since all connections and to and fro from proxy server, less chance of user’s machine being affected by Virus.
Now that we have a basic idea about What is Proxy server? and its advantages, lets see how to configure your own proxy server in any Linux Operating System. We will use Squid Proxy to install a proxy server and test its working.
So the steps to configure Squid proxy server are :
yum install squid -y
Install Squid if you don’t have it, and create a backup of the configuration file.vim /etc/squid/squid.conf
Open the configuration file inside /etc/squid with your favorite editor.- acl ‘hostname’ ‘IP/subnet’
acl ‘label’ dstdomain ‘file path’
Inside the configuration file,
– In ‘acl’ section add
‘acl [your hostname] [your IPclass/subnet]. ‘Acl’ stands for the access list.
– Below that if you need to block sites, create a label before ‘dstdomain’ (destination domain) and then write the path of the file which has the name of websites to be blocked.
– In the local net section, just below ‘acl’ section,uncomment the line containing your IP range. If you skip this step, you won’t be able to browse the internet. - http_access deny ‘label’
Search for ‘deny requests’ and in that, add a line
‘http _access deny ‘label’
– This will deny http access to the websites to the label name.
– Since the label nameis associated with a file, whose path you have defined earlier, http access would be denied to all websites inside that file. - http_access allow ‘hostname’
– Search for http_access allow and add a line
– http_access allow ‘your hostname’ - http_port 8080
– Search for ‘http_port’. The default port of Squid proxy server is 3128. If you want to change it, edit it here.
– Note: The same port number should be entered in your browser’s settings. - Create file containing blocked websites.
Go to the place you defined in ‘acl’ section for blocked websites. Create a file in that same place. - Enter names of websites to be blocked.
Enter the name of website you want to block inside that file. Save and quit. ifconfig
– Check your IP address.- Enter proxy settings in browser.
- Check your proxy server.
You can add ‘ visible hostname ‘hostname’ ‘ at the end of the configuration file, if you want squid to display your hostname.
For video tutorial check this video.