Raspberry Pi with Squid proxy to speed up your browsing
When several people use your connection, It can Cap. Especially if you there are fans of Pinterest, Facebook, etc. The pages will be refresh but often with common data. And this is where that Squid comes.
Squid going to cache your pages, check if the data are up to date, etc. After several days of use, the estimated gain (calculated by the logs via calamaris)
- Install Squid
sudo apt - get install squid
- Save the standard configuration file
cd /etc/squid/ sudo cp squid.conf squid.conf.origin
- You can filter the rows and remove the lines with comments. You will have a light ultra file !
sudo cat squid.conf.origin | egrep -v -e '^[[:blank:]]*#|^$' > squid.conf
By default the directory where your cache will be stored is /var/spool/squid /.
- Add your network at the end of the list of ACLs. At home I am locally on the 192.168.1.x. So I added the following line
acl LocalNet src 192.168.1.0/24
In contrast with this mask I had disabled (put # beginning of line) This default this ACL
#ACL localnet src 192.168.0.0/16 # RFC1918 possible internal network
- Allow machines on the network to connect to the proxy. Add the red line. The link is done with the name. Here LocalNet.
http_access allow localhost http_access allow LocalNet http_access deny all
- Reload Squid configuration
sudo /etc/init.d/squid reload
- You can now configure your browser or OS to use the HTTP proxy with the Raspberry Pi ip and port (by default) 3128.
For the management of configuration via a web interface, You can use Webmin. The tool allows to make all configuration changes.
- Install Webmin
mkdir webmin cd webmin/ wget http://prdownloads.sourceforge.net/webadmin/webmin-1.620.tar.gz tar zxvf webmin-1.620.tar.gz cd webmin-1.620/ sudo ./setup.sh /usr/local/webmin
- Install the calamaris log Analyzer, very convenient for usage of the proxy information
sudo apt - get install calamaris
You can now connect to the ip of your Pi Raspberry on port 10000. You identify yourself with the id and password from step 1.
At home I found the entry point in the menu ' a-used Modules’ because the default configuration is not good. You will therefore have to change a few settings to return the module to its place. Below my setup :
In the server section, You now have access to the entire configuration of Squid
With the logs and Calamaris you can track usage of your proxy and its performance :
Voilà. My Mac and my iPad are configured to go through the proxy. The ultimate test : Madam ! If I don't have notes genre “But why is slower” or “you're trying with your hacks”, alors c’est que ça valait le coup 😀
I work for DNS cache, the HTTPS, the occupation of the disk,memory and some other features which can still improve performance.