Adverts, got to love them, from those that tells me hot sexy singles are waiting to chat to me, hot singles in East London, really? To those trying to sell me the latest BMW,yeah, nothing wrong with that at all…
Adverts are a nuisance, what makes it more annoying is that a lot of adverts on websites are poorly embedded, so when read by a screen reader it is often gobbledygook. You may of notice this page has quite a few adverts, I’ve invited them here to help me with this tutorial. If you found this article helpful please click on these ads, I get paid! 😉 although if it was helpful you wouldn’t be able to see them afterwards so you should click on them now!
Ahem,
This is why a lot of people tend to install ad blockers to block these ads, but it means installing it on every single devices and that becomes tedious. Furthermore, there are certain devices such as your TV boxes and mobiled devices where you cannot install an adblocker on non-browser apps.
No fear, the Raspberry Pi I’ve been hyping on in previous post can help!
Introducing Pi-hole
Pi-hole is a DNS server that has a list of advertising sites such as Google’s AdSense in its database; drawing from this list, it can filter out popular advertising domains so it won’t be sent to the devices to your network. This means even some ads found on mobile devices and smart TVs are also blocked and not just within web browsers. The only exception is Youtube and Facebook, but it can stop Fb from following you around the internet.
Let’s get started with installing Pi-hole!
Login to your Raspberry Pi, and copy this into the prompt:
Copya message will tell you what the program does, hit ok.
A donation message will show up with a link to donate, you can just hit ok again.
The installer will then warn you about having a static IP, hit enter on ok.
Now you have to choose your interface, choose Eth0 if you’re Pi is connect to your router via an Ethernet or WLAN0 if wireless, I don’t know what TUN0 does; simply hit the spacebar on the interface, and enter.
You will then be asked to select an upstream DNS provider, this basically means that yes Pi-hole will have a list of advertising domains, but you still have to choose a list to work with the list with Pi-hole, a bit like choosing Yellow Pages or White Pages. You can learn more about each provider here.
I will go with Cloudflare’s as it’s one of the fastest DNS.
The next step will be choosing third party block lists, these are the sources Pi-hole draws upon to know which domains should be blocked. By default all of these are selected, and to unselect it just hit the space bar, I will use all of them so I will just hit enter here.
Then it will ask you to select protocols, I want all selected so I will hit enter again.
The installer will ask if you want to use your current network setting as the IP address, hit enter on yes.
A warning will say that sometimes your router can sign another devices to this IP which will mess everything up, your router shouldn’t have this issue as most router are smart. Hit ok
An IPV6 warning will pop up, hit ok once more.
Now it will ask if you want to install the web interface, I love to see how much sites Pi-hole blocks and other fun stats, so we are going to choose On.
It will then tell you that you need a web server for the web interface to work, we will select On again.
Next question is Do you want to log queries? Select On once more.
Now we are going to choose the privacy mode, this is only what the interface will show you, as we are nosy and want to see all, we will choose Show everything.
Finally the installer will have enough information to do its thing, give it a few minutes to install everything!
Once installed a final message will show up displaying some important messages, take note of the address of the web interface and the password which is needed to log into the web interface, and hit ok.
Now open a web browser on a computer that is on your network and go to the address in the previous step, it should be your Pi’s IP address followed with /admin, so mine is 192.168.72.182/admin
You should also be able to login using the password. If you didn’t take note of it, or if you wish to change it, go back to your Raspberry Pi prompt and type:
CopyEnter a new password and then confirm it.
Just one more step left, you now need to tell your router to get its DNS from Pi-hole. Unfortunately I cannot offer a step by step at this point as every router is different, but what it basically boils down to is logging into your router, then finding an option where it says DNS, selecting your own DNS server, and in the box, enter the IP address of your Raspberry Pi, and save settings. Then your router will reset and it should work, if this isn’t clear enough, please do a Google on your router model or ask your ISP.
Congratulations, your whole Network will now have an ad block!
To test this out, please refresh this page and the ads you saw near the top, should be gone now.
Just a few things to bear in mind: as the router is now getting its DNS from the Raspberry Pi, if your Pi is switched off you won’t be able to visit websites, so make sure your Pi is always on. Also I have been using it for a week now and so far it has worked very well, but sometimes some websites won’t display correctly, such as this one time when I tried to buy Skype subscription and they weren’t being shown to me as Pi-hole was blocking it. You can either add those sites to a whitelist on Pi-hole or you can disable Pi-hole temporarily by logging into your Raspberry Pi and typing:
CopyAnd once you are done type:
CopyBonus tip, set up a VPN and you will be able to have an ad block when you’re away from home as well.