Adblocker without Jailbreak:
On my computer I find using Adblock plus a handy way to speed up surfing and hide invasive pop-up ads.
Annoyingly you can’t install Adblock on an iPad without jailbreaking it – and I’ve yet to come across a way of installing it on Android devices easily without requiring root access.
Fortunately there’s an easy way to install Privoxy on a Raspberry Pi that can block adverts (and do a few other things as well) and that works seamlessly on iOS and more or less anything you attach to your network.
You could run this software on any PC attached to your network – but with the Pi’s low power consumption (3.5 watts) you can afford to leave it on all the time. Plus you could combine this functionality with a fileserver or an airplay speaker for a bit of extra usefulness.
Setting up your Raspberry Pi for remote control by iPad

First step is to prepare an SD card for your Pi – I’ve been using the default Raspbian.
Next step is to boot up the Pi with a screen and keyboard attached, and connected to your home network with an Ethernet cable. This would also work with a wireless connection, but ethernet is a bit simpler, more stable and means the Pi will run happily off a low powered USB adapter (e.g. a kindle power supply). On it’s first boot the Pi will run the config app – if you’ve already run your Pi before you can restart the config app by typing the following into the console:
sudo raspi-config
Make sure you change the default Pi password, and enable SSH in the menu. We’ll be using SSH to control the Pi remotely.
Now find your Pi’s IP address – in the terminal type:
ifconfig
This will give you some information about how the Pi is connecting to the network – make a note of the inet addr – usually 192.168.1.number (I’ll use this notation to refer to this value in the guide)
Next you can connect to your Pi using an SSH client – I’ve been using Remoter Fusion on the iPad (other SSH apps are available but I was using Remoter for something else) note that you will need to purchase SSH support in app which adds £5 to it’s price.
To connect to your Raspberry Pi with Remoter Fusion, click on discovery list -> Add Session Manually. On the Server Type choose SSH.
In the box that says SSH Hostname enter your Pi’s IP address which you found out above: 192.168.1.number then choose Manual – leave the SSH Port setting at 22 and in SSH Username enter your Pi username and SSH Password your Pi password.

Then connect – you might get a warning message (just accept) and then you should be seeing the Linux prompt.
Now you need to change your Pi from having a dynamic IP address (given to it by the router every time it reboots) to a static IP address which will stay the same. In the prompt type:
cd /etc/network
sudo nano interfaces
this launches nano which is a basic text editor – the following settings will depend on your Router – most routers will have a configuration page which will give you this information if you visit their configuration page – usually found on your network by typing 192.168.1.1 into a browser. The following settings worked for the BT Homehub version 3.
auto eth0 iface eth0 inet static address 192.168.1.number gateway 192.168.1.254 netmask 255.255.255.0 network 192.168.1.1 broadcast 192.168.1.255
Press control and O and then enter to save, followed by control and X to exit.
You might want to test your settings – either by using the Ping command, or by attaching a monitor / keyboard / mouse directly to the Pi and firing up the web-browser – the Pi should be able to connect to the internet.
Installing Privoxy on your Raspberry Pi
Finally we just need to install Privoxy – with the nice simple:
sudo apt-get install privoxy
then start Privoxy
sudo /etc/init.d/privoxy start
Then you’ll need to setup Privoxy by editing the configuration file –
sudo nano /etc/privoxy/config
This is a long file with lots of options – scroll or do a search with control W and find the listen-address line. Change it to 192.168.1.number:8118
Control O to save in nano then control X to exit.
Restart Privoxy with:
sudo /etc/init.d/privoxy restart
Now on your iPad go to settings -> Wi-Fi -> your network name and then scroll to the HTTP proxy options. Choose Manual and where it says Server type your Pi’s IP address: 192.168.1.number and where it says port type 8118.
Finally go to config.privoxy.org and if it’s all working correctly you should see an enabled message.
Straight out of the box Privoxy started blocking ads for me – you can edit the exact way it does this in the configuration files. So websites like this:

Become websites like this:

You can take this a bit further by turning your Pi into a personal VPN for secure browsing on the go with this Lifehacker tutorial.
Probably an overkill using a Pi for this, but it is handy being able to work on the Pi using an iPad and as I mentioned before there are a few other useful things your Pi could be doing at the same time.
17 replies on “Raspberry Pi as an adblock server for iPad, iPhone, Android and anything else on your network”
[…] http://kimondo.co.uk/raspberry-pi-as-an-adblock-server-for-ipad-iphone-android-and-anything-else-on-… […]
Great work – this is a great use for my 2nd RPi 🙂
its called Onion PI ! -.- . . .. https://learn.adafruit.com/onion-pi/overview
Thanks for the great tutorial! I set it up for my iPad but I have an issue: privoxy blocks Youtube and iMessage pictures. Could you tell me how to add the necessary lines to the config file? that would help me out a lot 🙂
Thanks! – I’ll check – but in the meantime have you tried using the bookmarklet option? http://www.privoxy.org/user-manual/appendix.html#BOOKMARKLETS I’ve noticed some youtube videos work fine, others are blocked.
Hi Maze W, I get the same thing with the out of the box functionality of Provoxy. I’ll post back here when I work out how to configure the actions file….
thx, I’ll try the bookmarklet for youtube. I’m still looking for the domains to unblock for imessage. @Pete @Ted Tofield Looking forward to whatever you find out!
That’s awesome!
I also found another adblock solution for ios that’s worth checking out. At http://iosadblock.webs.com, there are instructions on how you can block all Advertisements everywhere, in all of your apps, and in mobile safari.
Thats pretty nice and EXACTLY what i am looking for (because i want to buy a pi), but one question, is there a possibility to FORCE every Computer in MY NETWORK to use this Proxy?
Because some of my friends have an ipad too and they looking astonished when they see i have no ads in my ipad but they have, and i don’t wanna show them to always shut on / shut off the proxy.
[…] a useful app to test things with. If you use the instructions in the first bit of my post about using the Pi as an Adblock server you can also set the IP address to be the same each […]
[…] Pi’s ip address – you can get this from running ifconfig – ideally you need to set up your Pi to have a static ip address […]
[…] to peek round the Great Firewall of China, and for the paranoid you can protect your privacy with Privoxy or using TOR with the Onion […]
[…] by your router (the DHCP server). Although these addresses often don’t change, they can. You can assign a static IP address which is something i’ve used in the past, or install a service like no-ip that tracks your Pi’s IP address (and makes it available […]
I gave this a go last night, but I found the page load performance was quite poor.. so I’ve decided not to use Privoxy like this on a Pi. Bit of a shame. Thanks for the guide.. only took 10min to give it a go 🙂
Hot Tip: set the listen-address in /etc/privoxy/config to 0.0.0.0 (instead of 192.168.1.number).
This means that privoxy listens on ALL network interfaces (including the loopback interface).
[…] Use Privoxy as an ad-stripping proxy server on a Linux box such as the inexpensive Raspberry Pi featured in this article: http://kimondo.co.uk/raspberry-pi-as-an-adblock-server-for-ipad-iphone-android-and-anything-else-on-… […]
[…] Use Privoxy as an ad-stripping proxy server on a Linux box such as the inexpensive Raspberry Pi featured in this article: http://kimondo.co.uk/raspberry-pi-as-an-adblock-server-for-ipad-iphone-android-and-anything-else-on-… […]