Pi-Hole or how to adblock an entire network !

Hi everyone,

Do you use Adblock, Ublock or any other extension to block ads? In my case, I do so. It’s quite simple, I simply can not use a browser if I do not have an ad blocker installed!

A meme that explains my situation quite well 🙂 The problem with this kind of extensions is that they use a lot of processor/memory resources in addition to having to be installed on a browser to work. I know right, there are some browsers with built-in ad blockers but sometimes we just have neither the browser choice nor the ability to install an extension.

Sometimes we just want it to work, like a charm, naturally, without having anything to do, on all devices, pretty out-of-the-box though.

If you think as me, then you are at the right place, because today I suggest you this little tutorial DIY in order to definitively end the ads.

Ingredients:

– a Raspberry Pi 🍓 (sorry there was no more raspberry emojis)
– an SD card, a 4 GB SD card should be more than enough.
– an USB power supply (if you don’t have the official Raspberry power supply on hand, your USB phone charger is enough.
– a Linux distribution, the most popular on Raspberry Pi being Raspbian, we will use Rapsbian, but any distro does the trick!
– another computer (to configure our Raspberry)

Prepare the ground:

Usually, when unbox your Raspberry Pi, there is nothing installed, let’s fix this by plugging your SD card into the SD card reader of your other computer to install Raspbian as specified on this little tutorial

After that, we activate the SSH service of our Raspberry Pi by going into the boot partition (and not the /boot folder at the root).Once you are in the right partition, simply create an empty file named “ssh”.

Insert the SD card into the raspi port and you’re good to go. Turn everything on and SSH-connect to the Raspberry Pi:


ssh pi @ [LOCAL_RASPI_ADDRESS]

The default password is: “raspberry”

You can achieve that with the Bash terminal on Unix OS’s (Linux, BSD’s, Mac OS…) or with Putty on Windows

we put the IP of the Raspberry in the IP field
then we put the word of 🙂 Once you have the remote control over the RPI, change at least the password of the default user to ensure a minimum security with the command:


pi @ raspberry: ~ $ passwd
Current password: “raspberry”
New password: [ANYTHING_BUT_”raspberry”_!_!_!]
Confirmation of password: [the same password as previously entered 🤠]

Now it’s time to talk about the solution I chose: “Pi-Hole”. It’s a free and Open-Source solution, simplistic as hell which allows us to solve our little advertising problem in a quite intuitive and efficient way. Indeed, once we have implemented the solution, the Raspberry will play the role of “filter”.

The installation of Pi-Hole is very simple:

pi @ raspberry: ~ $ curl -sSL https://install.pi-hole.net | bash

the script should start:

What a raspberry … 😍

We run the installation script by navigating with the arrow keys on the keyboard until this step which I think is the most important of all. Those who read my article on DNS ( here ) will know what to choose 🤠.

Once the installation is complete, the address of an administration page and your password to access it are given, remember the password ! If you prefer another password, you can always change it via the command:

[email protected]:~ $ sudo pihole -a -p

Once everything is set up we just check that the admin page works, if all everything is fine you should deal with a page like this:

From there, you can configure Pi-Hole at your leisure or put finer settings if you wish. The advantage with this tool is we actually can monitor everything and potentially block everything, so please be careful to become a mini NSA or a Big Brother ! ☹️

This is typically the example not to follow 😥

From now on, you do as you feel! Indeed, you have three deployment choices:

– The sweet way, by replacing the DNS IP address on your router by the IP address of your Raspberry Pi. That way, It will change for you the DNS server settings of all other devices on the network.

– The fine way (or “case by case”), by changing the the DNS IP address of each device you want to “free” of ads.

– The radical way, disable DHCP from your router and let the Raspberry do it all alone via the built-in DHCP server.

The three methods will of course work. It only depends on how you choose to work. Personally I have a preference for the sweet way, because it is the one that I think is the least headache. For example, if you buy a new device, no configuration is required for this device because it will automatically retrieves the Raspberry IP address via your router.

Verdict

To have tested Pi-Hole, I must admit that this is the kind of solution as I like. Namely very easy to install, ultra simple to configure because it’s this kind of solution that will be the most effective. All served with a tastefully documentation that of course allows you to go further.

Voilà ! I hope you enjoyed this article, don’t hesitate to make your own idea and comment. We don’t change good habits, if you found this little DIY useful, spread it ! I’ll see you soon for a new article!

Until then, stay cool and drink water because water is life !

Leave a Reply

Your email address will not be published.

*