In this lab, we will provision and configure a simple Squid proxy server and test it with a client. We will also use an external web client system to test that it is caching web pages.
This Hands-On Lab can be taken stand-alone or as part of the LPIC-2: Linux Engineer Exam 202 preparation.
Successfully complete this lab by achieving the following learning objectives:
- Install Squid Proxy server software
Using the appropriate commands install the squid proxy server.
sudo yum install squid
- Walk through the configuration and make changes if appropriate
Make any changes to the squid configuration to suit the Lab environment if required.
cd /etc/squid vi squid.conf
NOTE: For this lab, you are not required to make any changes, the ACL for the local network (private) and the default port (3128) will
meet our requirements.
- Enable and start the service
Using the correct commands, start the service and enable it to restart on a system reboot.
sudo systemctl enable squid sudo systemctl start squid
You can check it is listening via
telnet localhost 3128
- Install and configure a web client for proxy use
Using the approriate commands, configure a web client for use with the proxy server.
On the second server, export the ‘http_proxy’ variable to the private IP of the squid server
export http_proxy=[squid server IP]:3128
- Use the client web browser to verify functionality
Check functionality of the Squid proxy server using a web browser or client.
Use the text web browser ‘lynx’ on server 2 to verify that a website comes up:
- Stop the squid proxy service to understand the various errors and what they mean. Once tested, then start the service again.
Using the correct system commands, stop the service, examine the errors. Start the service and examine any errors or messages.
Back on Server 1 (where squid is installed), stop the squid service
sudo systemctl stop squid
Verify it is stopped, the following should now fail:
telnet localhost 3128
- Change the proxy configuration to block access from the second server. Examine the message when you try access again.
Note: You will need to restart the proxy server.
Edit the ACL for the private network to exclude access
vi /etc/squid/squid.conf sudo systemctl restart squid
Check your client with Lynx and verify the error message
- Change the proxy server to reenable access from the server2 or second server.
Re enable the access to the second server.