DEV Community

Cover image for How to use PiHole and Block ALL ads in your network
Raissa Correia
Raissa Correia

Posted on

How to use PiHole and Block ALL ads in your network

I need to clarify that some ads can't be blocked for example: Youtube, Instagram and TikTok, because the ads' source is the same of the content, because this is a DNS filter.
However this is useful to take down annoying ads from free apps on mobile, because on PC it's easier and better to use an ad block extension.

I also need to tell that there are some collateral effects, the main one is:

  • If you're going to buy something all links in google shopping is a google ad, so they can't be loaded you have to disable piHole in the manager address "http://raspberry_pi_ip_address/admin"
  • Several web pages have problems to load you click the link and Network Error, reaload, DNS Probe Error, reload, loads like normal
  • I have a smart TV by Samsung, like I do, and if you disconnect from Wi-fi, you have to disable to connect your TV again

All disclaimers aside, let's implement to learn a bit about network!

1) First set up your raspberry pi, with a linux distro installed in the SD Card.

Discover the raspberry IP address, I used this command:
sudo nmap -sP $(ip addr | grep "inet " | awk '{ print $2}' | grep -v 127.0.0)

Keep it updated
https://www.makeuseof.com/tag/raspberry-pi-update-raspbian-os/

2) Then install with a single command!
curl -sSL https://install.pi-hole.net | bash

If you had any problems you can check it out here:
https://github.com/pi-hole/pi-hole/#one-step-automated-install

After install you'll see this in your terminal, save in a txt file.

Configure your devices to use the Pi-hole as their DNS server

│ using:



│ IPv4: IPv4 address of your raspberry pi

│ IPv6: IPv6 address of your raspberry pi



│ If you have not done so already, the above IP should be set to

│ static.



│ The install log is in /etc/pihole.



│ View the web interface at http://pi.hole/admin or

http://ip_address/admin (for me only this works)

3) Then the most complicated part, go to your router configuration and paste these 2 ip addresses in the right place!

For me, I'm using Claro in Brazil, that uses the Arris router system.
Gateway > Connection > Local IP Network > IPv4
You'll see the option: LAN's DNS, DNS da LAN(in portuguese)
Turn it static!
Paste the raspberry IPV4 in Primary DNS Server, leave the Secondary in blank
To avoid issues I didn't used the IPv6
Disconnect the devices from your network, and that's it! It's done!

4) If you want to block your ads everywhere, you can set up your VPN DNS server as the raspberry IP, the same as you did with your router

And the sub Reddit if you have any advanced questions:
https://www.reddit.com/r/pihole/

Enjoy!

Top comments (1)

Collapse
 
agokuzeusa profile image
Goku Zeas

For those looking for work in the area, the job postings are great since they provide chances in a variety of industries. Additionally, users may free classified ads post advertising for lost and found pets or adoption possibilities, as well as locate tickets for concerts, sporting events, and local attractions.