I installed Squid on my Raspberry Pi this morning. It seems to work rather well. Here are the steps I followed to make it happen; I'm not going to go into the details of each step. Feel free to ask if you need help with any step.
- Boot Linux on your Pi.
- Make sure your Pi is on the same private network as your PC and your router. If you're assigning its IP via DHCP it could work, but for obvious reasons, I'd suggest you manually assign it an IP yourself.
- Install Squid from your package manager (apt-get install squid if you're on Raspbian). It will have the advantage of providing you with an already working conf file
- Configure Squid via its conf file (more on this below)
- Restart Squid (on Raspbian it's /etc/init.d/restart squid)
- Configure your PC to use the proxy. The IP of the proxy is the IP of your Pi (hence the advantage of having a static address) and the port is specified in the conf file (usually 3128)
This should do the trick.
Configuring Squid
In order to configure Squid you need to know which network is connecting your PC, your RPi and your router. If you don't know how to do this, ask here on the forum.
Configuring Squid consists of modifying a conf file. Usually it will be located at
/etc/squid/squid.conf. Add the following lines to your file:
acl myprivatelan src YOURNETWORK # replace YOURNETWORK with your actual network.
http_access allow myprivatelan
icp_access allow myprivatelan
Remember to restart/reload Squid after each time you modify the conf file.
Some notes
- I'm not a security expert. I'm doing this to explore. This is the basic conf I gathered by going briefly through the doc. I might be doing it wrong.
- I don't run Raspbian on my RPi, I just assumed the commands I give would work.
- On your PC, you can configure each browser to use a proxy, or depending on your OS you may have a global setting for the system.
- Squid can do so much more, like having multiple proxy connect to one another, allow certain actions to certain users only based on authentication, geographical location, etc, etc. Don't be surprised if a full-fledged Squid install looks much more complicated.
- To verify that it works, check that each connection leaves a trace in the log file on your Pi. (by default: /var/log/squid/access.log). If it's empty, your traffic isn't going through Squid.
Problems
- One of my favorite features in modern browsers is that I can type a word in the address bar. If the word isn't a URL it would return a search result from my default search engine. This doesn't work anymore. I'm trying to fix it.
- I have no idea how to measure any improvements (if any at all). I have an "unlimited" plan with pretty high speed. Maybe I'll put some measuring box on top.
- This one hasn't happened yet, but it's coming soon. RPi may not be the best platform for this because of the SD card. Not only am I afraid that the space will be limited (I'm sure there's some logrotate feature, I'll explore this), but I'm also sure that SD cards won't support too much IO. I don't want to change cards every 2 months!