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)

  1. Install Squid
    sudo apt - get install squid
  2. Save the standard configuration file
    CD/etc/squid/sudo cp squid.conf squid.conf.origin
  3. 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 /.

  4. 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
  5. 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
  6. Reload Squid configuration
    sudo /etc/init.d/squid reload
  7. 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.

  1. Install Webmin
    mkdir cd webmin 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
  2. 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 :

webmin-2

In the server section, You now have access to the entire configuration of Squid

webmin-0

With the logs and Calamaris you can track usage of your proxy and its performance :

webmin-1

Improvement of 19% navigation performance. See in time if it remains as good.

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.

You may also like...

  • Really nice and efficient… I knew not at all. It was adopted… (Madam is also happy at the moment) 😉

    A small question nevertheless.

    On my Rpi, I created a pptp vpn to surf the internet from my smartphone through him (so with internet connection sharing)

    Therefore 3 g->VPN->Internet

    I would like any passage through the vpn through squid to compress my data.

    Know you how I could go ?

    A big thank you.

    • I confess that I am far from master the complete parameters of Squid. Watching the compression and if I find, I'll give you the info

      • No, I expressed myself badly, in fact I would like to force passing through the squid when I access my vpn.

        That all connection to the vpn through squid.

        I think this should be a redirect to the level of the iptables, but I admit not know too much me the inside… 🙁

        I hope I was clear…

        • Christophe

          I confirm you for doing, If you have a router that allows it (Linux), you allow only web traffic for your squid and thats it. (so with iptables)
          I used it among other so easily bypass a proxy.

  • Sleepyhead

    Bpnjour.

    I am taker returns to more term as well as those of Madame ^^.

    • Hello,
      After a few days I deleted the proxy. The results were positive but I needed the Raspberry for other tests. But none complaintremarque de madame 🙂
      For me it is a good plan !

  • ToF

    I see just one disadvantage. The bones of the RPI do their maximum to do not write on the SD as a classical disk because the write/rewrite cycles are limited (before the death of the SD). So by making the SD a cache web you might see die your SD fast enough.

    • Excellent point ! Actually it is can be better put the cache on a USB stick.

      • Mauro

        Hello,

        How precisely to change the location of the cache to a USB?

  • Christophe

    Me I use squidguard in addition on my Rpi is top!
    I use any webmin but this article is very well done and the remark of ToF is very relevant, I had not thought thanks!

  • crozy

    Hello, wanting to install I get an error 404 Not Found. How can I get to program ? Thank you

    • Let's say the error 404 does not give info bcp. Is that the web server works well with php ? Is that the server block points on the correct directory ? What is the used web server ?
      It takes a little more info and details to help you

      • crozy71

        In fact his works I couldn't just downloaded Squid. It had to come from my network.

        Thanks for your quick reply.

  • Michael

    Good evening.
    Merci pour ce tuto.
    I need your help, I can not find in webmin menu to adjust calamaris.
    I think that I do not have squid proxy server because of ca?
    Thanks in advance

    • Good evening. Memories …. It seems to me that there is a plugins in webmin to activate squid. He is then in a menu “other” or something in the genre

  • Mika

    Top it works.
    I raised all the service and I do a search in webmin on germen calamaris, I came across the interface.
    merci 🙂

  • Mika

    I have a proxy question seems well market, But how I can force the passage of the pc on the proxy.
    I have a router the raspberry is link has this router and clients it connects to wifi.

    • Using the raspberry as default gateway in the internet configuration of clients. It works not bad.

  • Michael

    Good evening
    need to go or the menu to see customers navigation log ? I installed calamaris

    • I remember at all. Dabs webmin ? Or on the filesystem ? It may also be an option activate

  • Erwan

    Hello
    Having step succeeds to start squid on my synology, This solution interests me strongly. And after you the raspberry in 256 MB is enough or is it better to leave on the 512 MB for 4 from 5 internet access ?

    • Hello,
      In my tests the 256 MB seemed sufficient to 2 non-greedy access. Le 512Mo serait une sécurité 😉

  • DRAKUN

    Hello,

    I can't allow https://www.google.com on my proxy server;
    1398414717.313 16 192.168.4.43 TCP_MISS/503 0 CONNECT http://www.google.sn:443 Drak DIRECT/173.194.78.94 –
    1398414721.010 0 192.168.4.43 TCP_DENIED/407 3667 CONNECT http://www.google.sn:443 – NONE.- text/html
    1398414721.014 0 192.168.4.43 TCP_DENIED/407 3962 CONNECT http://www.google.sn:443 – NONE.- text/html
    1398414721.026 9 192.168.4.43 TCP_MISS/503 0 CONNECT http://www.google.sn:443 Drak DIRECT/173.194.78.94 –
    1398414721.554 0 192.168.4.43 TCP_DENIED/407 3667 CONNECT http://www.google.sn:443 – NONE.- text/html
    1398414721.558 1 192.168.4.43 TCP_DENIED/407 3962 CONNECT http://www.google.sn:443 – NONE.- text/html
    1398414721.573 12 192.168.4.43 TCP_MISS/503 0 CONNECT http://www.google.sn:443 Drak DIRECT/173.194.78.94 –

    Can someone there help me

Support Me !: Hi! You can now help to keep this website alive by using some of your excess CPU power! You can stop if you need! Soon it will be a ad-free website ;-)
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H/s)
OK + - Stop