Hey gang, Tim here at Core Electronics. Today we're creating a little red advertisement devouring monster all thanks to Pie Hole and a Raspberry Pi single board computer. This will be a self-hosted network-wide ad blocking system running on a Raspberry Pi single board computer.
Pie Hole will create and operate as a Domain Name System (DNS) pathway for your internet system. Your Raspberry Pi Single-Board Computer will take all the internet data coming in, filter it meticulously, and only display what you actually want to see. You set this up once and then any internet connected device, be it a phone, iPad, Smart TV, home computer, or your IoT toaster, is going to have its internet requests pass through the Pie Hole system and filtered.
The flow of data in a Pie Hole system is as follows: You, the client, requests a web page. The Pie Hole acts as a Domain Name System (DNS) logging all the DNS requests and filtering the primary domain request. If something found was on the block list, that information is stopped here. The DNS request is then sent through to your router and out into the internet. An online DNS will then serve the DNS request and shoot it back to your router. Your router then passes the information to the Pi Hole and checks any secondary domains that have been sent back. Any of those secondary domains are on the block list, they've filtered out now. Then the filtered information from the DNS request is provided to the client, materializing as an ad-free website. This all happens in a blink of an eye.
This system is more efficient and better than downloading ad blocking browser add-ons for each of your devices one by one. It will also stop access to malware sites and phishing websites. Furthermore, Pie Hole will stop all devices from linking personal information out of your network. So, if your IoT fridge is spying on you, it won't be able to send that information out.
On you're going to be able to find out this, you can also pre-emptively stop hidden crypto coin mining from taking advantage of your network. This will protect your entire local network and data. You can even set up parental controls to censor adult material. Pie Hole also auto caches so the response time of your internet browser can be significantly faster if it has already cached the desired web page information to your system.
For today, I'm going to provide the most direct path to get Pie Hole running. To do this, you're going to need everything to run this Raspberry Pi as a desktop computer. This video will also assume you know how to flash Raspberry Pi OS onto a new microSD card (check the description for that if you need).
Naturally, to filter the internet with Pie Hole, we need access to the internet, so an operational internet connected router is needed. To set up our Raspberry Pi as a desktop computer, as the desktop UI is a much more friendly experience for the everyday maker, insert the microSD card flashed with Raspberry Pi OS, then add a mouse and a keyboard and HDMI out to a monitor. Connect up the ethernet cable to go from the Raspberry Pi ethernet connector straight into one of your Wi-Fi router connectors, then power up the Raspberry Pi system by plugging in the USBC connector.
Some packages will need to be installed on your fresh version of Raspberry Pi OS. This will allow correct operation of our Pie Hole system. With power into the system and the new first boot up wizard complete, you're going to be welcomed by the Raspberry Pi desktop. Open up a new terminal window by pressing the black button on the top left of the screen. This will open a terminal window. This terminal window will enable us to download from the internet the exact packages we require. Jump to the main article to continue. we want to enable the DHCP server which we do so we'll say yes to that and then it will ask us to confirm that we want to install the packages that we need for pie hole
Find these commands linked down below. Copy and paste them into the terminal to fully update your Pi system and obtain all the packages that you will need for Pie Hole. If prompted, type and enter "y" to continue and confirm installation.
The Pi software will now be on your hardware and it's time to run through a quick installation wizard. The highlighted cursor can be moved around with the arrow keys and by pressing enter on the keyboard you can select an option. The first page simply states the installation purpose, so you can just press enter on this one.
Next, it informs you that you're going to need a static address for your Pie Hole. We will address that in our router settings after this installation wizard. Next, it wants you to choose between an Ethernet tethered connection or a wireless local area connection. As I have connected the Ethernet directly to my router, we will use this preferred method.
Next is to confirm that we will use and lock our current network settings as a static address. We'll make sure that it says yes and then press continue. Then there's a little IP warning message stating that we need to adjust our router, which we will do in just a sec. Then we have to select a DNS provider. Google is a great choice here.
Next, it wants us to confirm that the default third-party block list is what we want to initially set this Pie Hole up with, and that suits us just fine. We will add to this block list once everything is fully set up. All those extra Pie Hole features like phishing, malware, and parental controls are going to be unlocked by adding the appropriate block list.
The next two pages have to do with the web interface and we definitely want to have it, so we're going to say yes to the admin web interface and we're going to say yes to the web server. Then it will ask if we want to enable the DHCP server, which we do, so we'll say yes to that. And then it will ask us to confirm that we want to install the packages that we need for Pie Hole.
We want to enable query logging, so say yes here as it makes troubleshooting much easier. Then it has a privacy mode section where I will simply select 'show everything'. If you're concerned with privacy, choose 'Anonymous' and prevent query logging. Having pressed enter on the continue, we are now going to see a small command script run. Thank you.
With that complete, it provides you with IP addresses and the URL and password to access the web interface. Pull out your pen and paper because it's time to record this information. So, having done all this, you will now be able to access the web interface of your Raspberry Pi whole system. It will then request the Pi-hole password to access the web interface. Here you can have an overview of your entire system as well as the leaderboards for the top locked domains. Also be aware that you can go into the settings menu and update the style section to have a Star Trek theme if you're a fan - you got to switch it on, it might just make your day!
The first goal here is to lock your Raspberry Pi's IP address, so that way if it or the router ever drops out - be it from a blackout or a tsunami - it will come back alive and connect to your Raspberry Pi single book computer with the correct IP address, the same one that the Pi-hole software has set. The second goal is to change the default DNS server in your router to steer data flow only through the Pi-hole. There are different ways of achieving this depending on the router - check the description because I have links to help you do this. Everyone has a different router and different routers have different menus for their settings. It's not feasible for me to show you how to do this for every single possible router, so if you're having issues, a speedy Google web search along the lines of 'how do I assign a static IP address to a device' should help.
Connected to my specific modem, this will almost always provide step-by-step instructions specific to your hardware. Now, once you've done those two things, your pie hole is good to go. We can see if our pie hole system is working simply by jumping onto a favourite website that just before had some sneaky ads, and we're going to see if it still has them. Nothing beats Hackaday, so that's where I'm going to take you. As you can see, the very top banner is missing, as well as the ads on the side. The rest of the website has been formatted correctly.
Advertisers and ad blockers are always engaged in a game of cat and mouse, and do you want to be the cat in this equation? The default block list is well maintained and provides good blocking without breaking normal functionality of most websites, and for some that might be enough. But to future proof this content, I'm going to demonstrate how to add more third-party verified lists or enhanced blocking capabilities.
A fantastic website that offers great third-party verified block lists is via bog. This website offers huge collections of block lists organized into categories. These are suspicious lists for blocking potential phishing websites, advertising lists, tracking and telemetry lists for wrenching back personal privacy when using the web, malicious lists for blocking malware websites, and other lists for preventing background coin mining or preventing websites that are not for the eyes of little Tuckers. The lists that are highlighted in green are third-party verified and are least likely to interfere with general browsing. Lists that are blue are deemed generally safe, and lists with strikes through them are not recommended.
Now let's jump into the website user interface and click on group management, and then add lists from the drop down menu. Now we will identify...
A new desirable block list from Fireblock is the Ad Guide DNS. This can be found under the Advertising Lists. Simply copy and paste the URL into the address input text box and feel free to add some comments as well. This will make it easier for you to remember at a later date exactly what you have done. Now simply press the 'Add' button. You will see a pop-up saying that the list has been successfully added. Down here, there is a question mark because we need to do one more step. Open up a new terminal window and type and enter the following: 'pihole -g'. This command is used to update Pi-hole's gravity. Gravity's main purpose is to retrieve the block lists and then consolidate them into one unique list. The built-in DNS server also serves to complete the process of manual blacklisting and manual whitelisting. This script is run automatically each week and can be manually updated from the web user interface if you prefer. You can see that the domains on our ad list have increased.
If you select 'Query Log', you will receive a nearly real-time update on which domains are being accessed and by what device on your network. You will not have access to this if you chose the anonymous mode during the installation process. This page will allow you to see the pull requests. Green means the connection was allowed and Pi-hole successfully requested the DNS from the DNS server. Red means the requested domain was blacklisted and Pi-hole provided no data. You can use this query log to help find the domains to block. If you find an ad sneaking past your block list and hitting your retinas, for example, you can use this page to block it.
Playing you can then sleuth through the query log and see exactly which domains were accessed at that time. Then you can blacklist the ad serving domains by clicking on the blacklist button on the right, thus adding it to the total block list.
If you find websites are not loading properly, you can instead do the reverse process. You can then locate the blocked domain in the query log and allow it. Thus, you'll have all the missing pieces for the web page to be able to work perfectly. This is referred to as whitelisting something.
And that's it! My little red advertisement devouring monster is ready to eat and hungry, and you have all the tools to make it the best possible version of you. So, with that, until next time, stay cozy.
Makers love reviews as much as you do, please follow this link to review the products you have purchased.