Home Cyberpunk Shut your Pi-Hole: Batten Down Your Privacy Hatches with This Raspberry Pi Adblocker

Shut your Pi-Hole: Batten Down Your Privacy Hatches with This Raspberry Pi Adblocker

by David Rutland

Finally! We Can Block All the Ads!

Let’s cut through the bullshit. No one likes advertisements. By design, they’re intrusive – they exist to grab your attention, and by force of repetition, to drum home a message. You should buy this product; you should think this way; you should vote for this guy or that guy; you shouldn’t eat meat. You should STAY INDOORS. 

Personally, I haven’t seen an advert on any medium bar billboards in about a decade. Does CyberPunks.com run adverts? I genuinely don’t know.

I, along with millions of other internet dwellers, use adblocking software to ensure that my eyeballs aren’t assaulted with exhortations to buy the latest piece of Apple or Sony crapware that’s only marginally different from the previous model of Apple or Sony crapware you already own.

Shut your Pi-Hole: Batten Down Your Privacy Hatches with This Raspberry Pi Adblocker
Shut Your PiHole Logo - Raspberry Pi Adblocker - CyberPunks.com
Shut Your PiHole Logo - Raspberry Pi Adblocker - CyberPunks.com

Down Your Raspberry Pi-hole

We could stop the article right here by saying that there is software called Pi-hole and that it blocks adverts across your entire network and further afield if you don’t mind a little extra work. We could leave it at that and be satisfied knowing that our readership is perfectly capable of doing a little research themselves.

We’re not going to. Like a well endowed mechanophiliac, we’re going to go right up into the Pi-hole’s guts for you.

How Does An Adblocker Work?

Every time your device loads a webpage, it sends requests to the server for the various bits and pieces of the webpage you want to view. Text is generally served from the main server. Images are often hosted on a dedicated image server for speed purposes. Third party add-ons, such as adverts, are hosted on the ad company’s own servers with their own URL. With us so far?

These URLs come back to your device, which then asks a DNS (Domain Name Server), exactly where that URL is located. What is its IP address? The URL of the site you’re on now is cyberpunks.com, and its IP at the time of writing is 192.124.249.19***. IPs shift from time to time, and DNS servers make sure that the right traffic ends up in the right place.

What the Pi-hole does is to act as the primary DNS on your network. It maintains it’s own list of URLs and domains which are known to be ad servers or malware hosts, and any request being made has to pass through the Pi-hole first. If the domain being requested is on one of the Pi-hole’s lists, the request is never passed on. It disappears and is never seen again. If the URL isn’t on a list, it gets passed along to an upstream DNS such as OpenDNS, and the IP address is returned to the requesting device.

TL;DR: Ads are no longer served.

Why The Raspberry Pi?

Pi-hole was written for the Raspberry Pi, but it doesn’t need to be run on one. It will be perfectly happy sitting on any Linux machine, or even on a virtual machine being run on a windows machine. Or a Mac. Whatever.

But unless you’re willing to leave your tower system or laptop on 24 hours per day seven days per week, your adblock capability will stop working whenever you turn the host machine off. If you’ve configured Pi-hole as a DHCP server (more on this further down), all the devices on your network will lose internet access completely. It’s not ideal.

The Raspberry Pi was designed as a low power system. Even the latest 4B model (now boasting an astonishing 8GB of RAM) will only draw down 15 Watts at most. In comparison, most laptops pull around 60 to 90 Watts. Desktop rigs run from around 350 Watts up into the kilowatt range. The electricity bill for leaving your Pi on all night isn’t going to put a huge dent into your finances.

We’re running Pi-hole on the 2GB variant of the 4B, but it will function perfectly well on a $5 Pi Zero.

If you're enjoying what you're reading, why not go ahead and sign up for updates from CyberPunks.com?

Installating Pi-Hole

We’d love to pretend we’re tech gods and that the Pi-hole installation was in any way difficult or technically demanding, but we can’t. With a couple of caveats, it’s an extremely simple piece of software to set up and use. There’s a one step automated installer, or you can run it in a docker container. After which it’s as simple as changing the DNS server address on your router to that of your Pi-hole, and visiting Pi-hole.local on your network to view the beautifully designed dashboard, do some final configuration, and check out the stats.

This is assuming that your router lets you change the DNS server. Some routers don’t. Ours, a Vodafone Connect which was supplied by the company, does not. Other Vodafone router models (usually Huawei models in disguise) have various firmware issues which cause the configuration page to hang. YMMV.

Dear God, Picture Guy. Try Harder.
Dear God, Picture Guy. Try Harder.

In these cases, you’ll need to hand over the DHCP management to the Pi-hole. It sounds more complicated than it is, and there are instructions on the Pi-hole site which cover almost every eventuality.

If you want your mobile devices to be covered while you’re out and about, you can force them to use your Pi-hole DNS too. Like we said, simple.

Shut your Pi-Hole: Batten Down Your Privacy Hatches with This Raspberry Pi Adblocker

Living with the Pi-hole

What can we say. It works. Every request made by every machine on the network goes through the Pi-hole and requests for adverts disappear into the black hole. You’ll spend hours studying your network traffic, trying to work out which requests could be linked to trackers and which apps are phoning home unnecessarily. The address data-vef.xboxlive.com is apparently to do with Xbox live achievements. But there’s no Xbox here, and although my son is playing Minecraft (local server only), does it really need to contact Microsoft almost 6,000 times in a 24 hour period.

Likewise, my Roku streaming stick has attempted to contact scribe.logs.roku.com 5,509 times since I blacklisted the address. Blocking it stopped the ads and prevented Roku from knowing what I’ve been watching on the hardware it built, but it also stopped my screensaver from working. Worth it? I think so.

You may also find that certain sites will simply will not load if you’re running traffic through Pi-hole. The solution is simple. Don’t use that website.

Is It the Right Thing to Do?

Some of the more thoughtful cyberpunks among our readership would argue that without adverts, the internet would simply cease to exist, disappearing in a puff of PCB flavoured smoke as funding evaporates. To a certain extent, they’re right.

Advertisements make the internet work. Websites are expensive to run. Bandwidth costs money. Stock photo subscriptions need renewing. Writers stop writing if you don’t pay them.

If you were hanging round on tech websites back in 2010, you may remember the controversy and sheer outrage generated when Ars Technica, that venerable bastion of all things arsey and technical, briefly blocked browsers which were blocking ads. The readership went apeshit, and Ars pulled down the wall, allowing access to ad viewers and ad blockers alike. They later published an article explaining “Why Ad Blocking is devastating to the sites you love.”

A decade ago, adverts were not what they are today. Sure, they were intrusive and annoying and there was some degree of tracking by companies which followed you from site to site in order to sell you a Playstation 3 game you already owned , but you couldn’t argue that they were evil.

Back in the hazy days of our youth, advertising trackers weren’t following you into the real world. Shady analytics companies (probably) weren’t using the tracking code to identify key voters who could swing an election or referendum and targeting them with news and information to persuade them to vote a certain way.

If a site won’t let you view their content without selling your data to corporations which can no longer claim that they strive not to be evil, you shouldn’t be visiting them at all.

Hey, chum. These posts don't write themselves. If you wanna stay in the know, it's gotta be a two way street.*

Leave a Comment

You may also like