Block Ads on All Home Devices for $53.18

With a Raspberry Pi + the Pi-Hole Project

Adblocking hardware (Pi 2 shown)

I recently set up a Raspberry Pi as an adblocker at home, using the pi-hole.net project. It acts as a domain name (DNS) server across your network, so instead of pointing to the DNS provided by your internet service provider or something like OpenDNS or Google, you point to the Pi’s local-network IP address first (e.g. 192.168.1.81), and it will block any requests to known adserving/pixel-serving URLs compiled from various lists online. On the other hand, if the domain you’re requesting is not on that list, it will point to public DNS servers to route the traffic correctly.

I’m also excited to announce that this project will be one of Optimal.com’s blocking partners — offering users the option to (but not requiring) pay a low cross-website fee, that we’ll distribute to website publishers, for avoiding ads and tracking. Below is what you will need and how to set it up!

(I’ve written about why Optimal is building a paid option for adblocking, to make sure we can still enjoy all the ad-supported content out on the web (and help get rid of the low-value content intermediaries that create only ad-arbitrage landing pages!) … sign up for our waitlist at Optimal.com to learn more, coming soon.)

Total hardware cost: $53.18

Raspberry Pi 512Mb Model B — $39.95 (Adafruit, free shipping)

SanDisk 4Gb MicroSDHC card — $5.24 (Amazon, free shipping)

Kootek MicroUSB charger — $7.99 (Amazon, free shipping)

I assume you already have: an HDMI cable, a TV to connect it to, a USB PC keyboard, and an Ethernet cable to connect the Pi to your home router (or a a switch that is). Note: I also successfully implemented the project with the slightly-more expensive Pi 2, but a B works just fine.

Fair warning: Some command line Linux required, but it’s not too bad! Here are the steps for doing this from a Mac running OS X, click this:

(Note that it appears that the interface is now part of the installer, so you may not need to do lines 28–39 any longer)

After you’ve done all this, very important you need to configure your various devices to use your new DNS server at home! This is pretty easy, here’s how to do it for an iPhone and a Mac:

iPhone step 1

iPhone step 2

iPhone step 3

If the site isn’t rendering correctly or you want to show ads again either go back to the original DNS settings that were in place before you changed it, or use the OpenDNS or Google server IPs (208.67.222.222 and 208.67.220.220, or 8.8.8.8 and 8.8.4.4). For setting up your Mac:

Mac OS X Step 1 — System Preferences

Mac OS X Step 2

Mac OS X Step 3

Mac OS X Step 4, hit OK and Apply on the previous screen

And you should be good! You obviously have the keep the Pi webserver running otherwise your internet access will be negatively affected, but it need not be connected to the keyboard or TV unless you need to log in and make changes! Visit the dashboard that should be running on your Pi from your browser to see the daily counts of blocked advertising/tracking domains (e.g. http://192.168.1.81/admin/index.php#). Note that Comcast has had DNS outages in the past, so getting familiar with these options and input other public DNS servers if needed, seems like a good thing anyway.

There’s obviously plenty more documentation on the pi-hole.net website and on github, (e.g. thinking about IPv6 issues etc) so have fun with it if you decide to play around!

Some additional useful links:

— go to http://pi-hole.net/help for FAQs if you get stuck while setting it up

— if that doesn’t help, you can also open an issue on Github

— Go here if you are interested in more of the technical details

So for now I’m going to set aside the excellent home adblocker solution until we complete our integration with the Pi-Hole project so I can keep publishers getting paid while also blocking ads across my home network!

Stay tuned for more news from me on Twitter, here on Medium or at Optimal.com.