Matter, Energy, and Life of Michaela A. Castello.

Pi-Hole Setup


Way back when, I ordered one of the early Raspberry Pi Model B units with the intent of using it as an HTPC. I only recently accomplished that goal: in 2012, the unit had HDMI output and ethernet sharing a bus, which meant that it specifically could not play HD quality video (at that time, 1080p) from a network source (USB sources worked just fine). That original Pi has languished in my computer toolbox ever since, waiting to be assigned a purpose. Today, that purpose was found.

I have been blocking ads since the Firefox browser came out, attempting to stay ahead of the escalating arms race for online attention. I’ve had a lot of success using Nano Adblocker (based on the also-good uBlock Origin) in my browsers, but my Achilles heel has been mobile devices, which don’t have nearly as robust blocking capabilities without significant tinkering. Enter Pi-hole, a way to use a Raspberry Pi as a DNS-level filter for an entire network. If something is trying to reach an ad server, it stops the request from ever leaving the house.

Hardware

Computer: Raspberry Pi Model B revision 2 (Fall 2012). I was super excited when this first came out and had to wait for backorders to ship due to its popularity.

Storage: 16 GB Class 6 SD card. This is actually a microSD card in an adapter; the original Raspberry Pi has a full-sized SD card slot.

Case: Original plastic Raspberry Pi case. It’s functional, but a far cry from the ABS plastic they’re using to make the official case now or the hefty aluminum case by Flirc.

Accessories: USB mini-A power supply, random HDMI cable to connect it to a monitor during setup.

Software

OS: Raspbian Lite, the official OS for Raspberry Pi, minus a desktop environment.

Ad blocking: Pi-hole, a black hole for internet advertisements.

Assembly

I started by using the handy-dandy imager to write Raspbian Lite to a 16 GB SD card I had laying around. There was a clear difference in write speed between this and the Class 10 card I used on the other build. My first attempt—using a 4 GB Class 4 SD card I pulled out of the junk drawer, likely purchased in 2012 with the RPi itself—didn’t work per the LED blink codes. In my experience this means there was some kind of cruft leftover on the card from previous bootable OS installations that doesn’t get eradicated by these imagers. I probably should have tried using a real SD card formatter first, but the newer card distracted me by working instantly.

I wanted to try to do the entire installation headless (no monitor output or keyboard/mouse inputs), but due to the SD card issues I ended up caving and using a keyboard and screen for setup. From my reading, ssh can be pre-enabled ssh by adding a blank file named “ssh” with no extension to the root folder before moving the card to the RPi and booting it. It’s even easier with a screen, where raspi-config can be used to set up everything.

sudo raspi-config

A couple tweaks: Since I wasn’t going to be using a screen after this, I set the GPU memory to 16 (down from the default of 64). I also had to change the keyboard layout to US from UK in order to complete the installation of Pi-hole itself, which involved using the pipe character. I went with the fully automated install but there are other methods that give even more control.

curl -sSL https://install.pi-hole.net | bash

This installer goes through everything pretty quickly. I kept just about everything with defaults, selecting all available filter lists. For resolving all the good DNS requests, I decided to go with OpenDNS to avoid both Google and Time Warner Spectrum, although the truly privacy-minded have numerous other preferences.

Once the Pi-hole device is up and running, it’s simply a matter of pointing the router at it. I went into the router settings and left everything the same except for changing the DNS server to the static IP address of the Pi-hole (I did this for both IPv4 and IPv6 addresses).

An important concern was raised about how this might affect work things. In my experience so far there have been no difficulties; I was able to VPN into work and run Citrix applications without changing any settings. However, if there are issues, there is a neat web interface that can display everything it has blocked and those domains can be manually whitelisted if necessary.

As far as whether this affects internet connection speeds, essentially it doesn’t because it is only filtering DNS queries, not all network traffic. If anything, it can speed the connection up by loading less stuff: Mobile sites, in particular, are cancerous with ads. It’s about time they got hit with a little Pi-hole pegaspargase.


You may also enjoy…


Want more? Keep up with the hottest content.