Blocking ALL ads on my network

This week I treated myself to a Raspberry PI 3+, not the latest model but probably overkill for what I had planned. A Raspberry PI Zero would have met my requirements, but good luck finding one of them in today’s market.

No description available.

At Christmas, my nephew was happily playing on his new iPad. I sat next to him and watched as he continuously, and subconsciously tapped to remove ads from interfering. It’s disgusting the volume of ads kids have to endure just to play a bloody game.

Not in my house.

Ad-free home

If my nephew wants to come over and play on his iPad, he will be connecting to an ad-free zone. That’s the plan anyway.

Introducing Pi-hole a DNS sinkhole that’ll do exactly what I need.

Installing Pi-hole

Installing Pi-hole is a pretty simple process, boot up your Pi and run the following command:

curl -sSL | bash

More information on the installation can be found on their Github, or just have a nose at the code.

The installer will take you through various setup options, all of which I’d keep to default.

When you’ve gone through the steps you should now have Pi-hole running, you can check this by going to the specified ip /admin, so for me it’s:

You’ll be presented with a handy dashboard, where you can see how well the Pi-hole is working for you.

Using Pi-hole as a DHCP server

For most routers you’d simply change the DNS to point to your Pi-hole’s IP, but for me — using a Bt Smart Hub — this option isn’t available. Instead I had to disable the DHCP setting in the router:

And update Pi-hole to enable the DHCP server:

This means that Pi-hole is now response for distributing IPs in my network.

To test this, on my windows PC. I first need to release my current IP:

ipconfig /release

You can do this in any shell.

Then I needed to renew my ip:

ipconfig /renew

Notice the name of the Connection-specific DNS Suffix is rp-lan which I specified in the Pi-hole config, see previous screenshot.

Not enough ads are being blocked

So Pi-hole isn’t a complete solution, it doesn’t block all ads, it only blocks the servers that are specified in the ads list.

On the Pi-hole dashboard when you first install you’ll likely see you’re blocking around 50k domains. In my case I’m blocking:

This may not be enough for you, so you’ll need to add more servers to the blacklist. provides an up to date list of servers that you can add. If a list has a green tick by it it’s unlikely to interfere with your browsing. If it has a strike through it, then it has too many false positives (tries to block something that isn’t an ad).

Simply copy one or many of the lists, and paste them into Pi-hole | group management | ads list:

Click Add, then when that’s finished you’ll need to update gravity, tools | update gravity

When that’s done, the new blocked domains will have been added. To double-check, go to your dashboard and make sure the number of blocked domains has increased.

Automatically update ads lists

The fight between ad blockers and sellers will go on forever, there’s always going to be new ads that aren’t being blocked by your Pi-hole, and some will slip through the net. You don’t want to have to manually go update your Pi-hole every few months with new ads lists — well, I don’t.

Somebody’s already thought of this for you. Pihole-updatelists will handle this dirty work. All you need to do is run the following script on your Pi:

wget -O - | sudo bash

You may have to do some additional steps, depending on your setup, so it’s worth checking the Github.

Ah that’s pretty much it, in my setup I just have to make sure every device release/renews their IPs.

I hope you enjoyed this blog, don’t forget to sign up to the newsletter – Be the first to hear when we release new content, participate in weekly coding challenges, listen to more of my drivelling. If you like the Raspberry PI content, check out my previous blog on the Pico.

Leave a Reply