Skip to content

Alle Werbekonzerne HASSEN diesen Trick!

Learn how to build a DIY ad blocker using a Raspberry Pi, Pi-hole, and Tailscale to block ads on all devices securely and for free.

Key Takeaways

  • Pi-hole blocks ads by returning invalid IP addresses for advertiser domains via DNS.
  • A Raspberry Pi is ideal for running Pi-hole due to its low power use and reliability.
  • Tailscale VPN enables secure, remote access to the ad blocker from anywhere.
  • The combination of Pi-hole and Tailscale solves common home network issues with ad blockers.
  • This DIY ad blocker protects privacy without subscriptions or data selling.

What the video covers

  • The video explains how to build a popular DIY ad blocker using a Raspberry Pi and Pi-hole software.
  • Pi-hole works as a DNS server that blocks IP addresses of advertisers, preventing ads from loading on devices.
  • The Raspberry Pi Zero or Raspberry Pi 4 Model B is recommended due to low power consumption and sufficient RAM.
  • Tailscale VPN is used to securely connect to the Pi-hole DNS server from anywhere, not just at home.
  • Tailscale is free for personal use, encrypts all traffic, and does not monetize user data.
  • The video covers step-by-step instructions to install Raspberry Pi OS Lite, Pi-hole, and configure Tailscale.
  • Using Tailscale avoids common issues like internet outages if the Pi-hole server fails or if some websites don't work well with ad blockers.
  • The setup allows ad blocking on mobile devices like iPhones by connecting through Tailscale.
  • The video also discusses hardware recommendations, price trends, and the benefits of using a wired connection to the router.
  • Additional tips include managing DNS settings safely and troubleshooting common problems with ad blockers.

Answers

Questions about this video

What hardware do I need to build this ad blocker?

You need a Raspberry Pi (preferably Raspberry Pi 4 Model B with 1 GB RAM or a Raspberry Pi Zero), a microSD card (32 GB recommended), and a power supply.

How does Pi-hole block ads on my devices?

Pi-hole acts as a DNS server that returns invalid IP addresses for known advertiser domains, preventing ads from loading on any device using it as the DNS resolver.

Why is Tailscale used with Pi-hole?

Tailscale provides a secure VPN connection that allows you to use the Pi-hole ad blocker from anywhere, not just when connected to your home Wi-Fi, and it helps avoid network issues if the Pi-hole server fails.

Full Transcript — Download SRT & Markdown

00:00
Speaker A
This right here is currently one of the most popular DIY projects on YouTube. Do you see this advertisement? And now I'm plugging in the power. Look, the ad has disappeared. But not just there. My Mac was full of ads just a moment ago.
00:15
Speaker A
They are suddenly gone, too. They vanish from all devices, even when I'm out and about. You can build this brilliant ad blocker yourself, too. You don't need a subscription or anything like that. And you won't be paying with
00:28
Speaker A
your personal data either. All you need is a mini computer like a Raspberry Pi.
00:33
Speaker A
You can sometimes find one for less than 30 euros. I have been a system administrator for the last 20 years.
00:40
Speaker A
Today, I want to show you how to properly install this ad blocker without crashing your Wi-Fi. We'll do that using the software Pi-hole and Tailscale. Many people still don't know this. For personal use, Tailscale is absolutely free and therefore perfect
00:58
Speaker A
for this free ad blocker. Tailscale even supports me so I can make this video for you. First, I'd like to let you in on the secret of how this ad blocker actually works. The concept of this ad blocker is absolutely brilliant
01:15
Speaker A
and quickly explained. When you call your buddy Uwe, you just tap his name in your phonebook. But your phone uses Uwe's number to reach him. Computers also use numbers in the background to reach each other, so-called IP addresses. And computers look up these
01:36
Speaker A
IP addresses in the so-called Domain Name System, or DNS. The DNS is basically like a phonebook for computers. By the way, you can look up such IP addresses yourself using the terminal I have open here and the dig
01:54
Speaker A
command. If I want the IP addresses for the website chefkoch.de, for example, I just hit enter and, presto, they are displayed. There are even several. When you pull up Chefkoch in your browser, you don't notice these IP addresses at
02:12
Speaker A
all. But you are missing something else as well. Websites usually consist of many different puzzle pieces that are loaded from various computers.
02:24
Speaker A
Including the puzzle pieces with ads. This ad here doesn't actually come from Chefkoch, but, as you can see in the status bar below, from doubleclick.net.
02:37
Speaker A
For my computer to download and display these ads, it first has to figure out the IP addresses for doubleclick.net.
02:47
Speaker A
to find out. And now it gets interesting. I have installed a very special DNS server called Pi-hole on this little mini computer. installed.
02:57
Speaker A
Look at the addresses it gives me. I am using the same command as before. I'm just telling it to query the ad blocker now, instead of my router, for the IP addresses. And from the ad blocker, I get the normal IP addresses for
03:13
Speaker A
Chefkoch. But what happens if I query this advertiser, or their IP addresses, then I get a completely different answer: 0.0.0.0. That is an invalid IP address. If I now activate this DNS server, which I can do quite easily
03:33
Speaker A
with Tailscale. So, it's activated now, and when I reload the website, something terrible happens. My browser unfortunately doesn't know where to load the ads from. It received invalid IP addresses, and so it unfortunately doesn't display them. Annoying, right?
03:53
Speaker A
That is exactly how the ad blocker Pi-hole works, a DNS server that doesn't give out IP addresses for advertisers. And now let's take a look at why Pi-hole is made for the Raspberry Pi. A DNS server is a
04:10
Speaker A
critical component in your Wi-Fi. If you simply install Pi-hole on your computer and then turn it off. Then your kids will call child protective services, because then no one in your household can access the internet. So you have to ensure that this DNS server
04:29
Speaker A
, Pi-hole, runs permanently. This Raspberry Pi Zero consumes extremely little power, which makes this cute mini-computer a popular home server for exactly such tasks. Because of this, these models are unfortunately quickly sold out, and the increased prices for
04:50
Speaker A
RAM also cause costs to explode a bit here. But Pi-hole doesn't need much RAM . 1 GB is completely sufficient, and these are the cheapest Raspberry Pis.
05:03
Speaker A
It doesn't have to be the latest Raspberry Pi either. I even tested this ad blocker on a 15-year-old Pi. My tip: Don't buy the current model, but rather the Raspberry Pi 4 Model B. That's the previous model. 1 GB is more than
05:20
Speaker A
enough. If we look at the price trend over the last 12 months, you can see that it was a bit crazy here a few months ago, but the price has normalized again, just under €40.
05:34
Speaker A
You can also connect a network cable there, connecting it directly to your router, and in doing so, you essentially bypass all Wi-Fi-related problems. Then you still need a microSD card, preferably a branded SD card from SanDisk or similar. 32 GB is enough,
05:51
Speaker A
costs maybe €20. And a matching power supply—for the original Raspberry Pi power supply, I paid €6.90. You don't absolutely need the next thing, but with it, you elegantly solve three problems of this ad blocker . Many tutorials recommend that you
06:11
Speaker A
permanently change the DNS server in your FritzBox to Pi-hole. Your Raspberry Pi can, and will, fail at some point. For example, if someone pulls out the cable, or maybe if a dog thinks it's a great treat. So, no
06:28
Speaker A
internet. Very few home users are able to systematically isolate and fix this source of the problem. Another problem.
06:39
Speaker A
Some websites just don't get along well with Pi-hole. I'll talk more about that in a moment. And this ad blocker is only available to you when you are actually at home with your devices.
06:50
Speaker A
These three problems can be elegantly solved with Tailscale. Tailscale is a modern VPN for connecting devices simply and securely. All traffic between the devices is encrypted. So no one can read along. This allows you to access your ad blocker from anywhere,
07:10
Speaker A
whether at home or on the go. But the brilliant part is setting Pi-hole as the DNS server in your secure Tailscale network instead of in the FritzBox. You don't have to change anything, and if a website acts up or the Raspberry Pi
07:25
Speaker A
fails, no problem; just turn off Tailscale. This doesn't just turn off Pi-hole as a DNS server, but also the ad blocker. You can leave Tailscale turned on permanently. It works whether you are at home or on the road. It is
07:42
Speaker A
based on a very resource-efficient VPN protocol, namely WireGuard. And only the DNS requests are actually sent via Tailscale. So, very small amounts of data. The actual data from websites is loaded directly via the Wi-Fi. The battery consumption of Tailscale on the
08:00
Speaker A
iPhone is also really minimal. For me, it's around 1 to 2%. Exactly. That's why a Raspberry Pi-hole plus Tailscale is a popular combination. The two just belong together. A bit like fries with mayo and ketchup. For private use,
08:20
Speaker A
Tailscale is, as mentioned, free. Tailscale doesn't make money from your data either, because the traffic is fully encrypted and Tailscale can't even see it; they earn from business users looking for a secure and easy-to-use VPN. And if you are a
08:38
Speaker A
freelancer or entrepreneur, you can even get discounts with the code "Burn". But regardless of whether you use Tailscale for free or with the coupon.
08:47
Speaker A
First, download the app via the first link in the video description and then install it. Then you set up a Tailscale account via Apple, Google, and so on.
08:57
Speaker A
Tailscale cannot access your data there; it only uses it to verify your identity. If you want to get rid of ads on your iPhone, then install the Tailscale app there too and add it to your secure Tailnet. Now we will build
09:15
Speaker A
your new ad blocker together. If you follow these steps one after the other, your ad blocker will be running in a few minutes. You can find everything important below in the video description as well. First, connect the microSD card to your Mac. Then download
09:33
Speaker A
the Raspberry Pi Imager, copy it to the Applications folder, and open the app. First, you need to select which Raspberry Pi model you have. For me, it's the Raspberry Pi 02W. For the operating system, use Raspberry Pi OS
09:50
Speaker A
Lite. Then select the memory card; you can also identify it by its size. The hostname is the name of the computer. I would
10:08
Speaker A
username and choose a login password. It is perfectly fine to use the same password you use to log into your computer. If you don't have a Raspberry Pi model with an Ethernet port, you must enter your Wi-Fi credentials here.
10:25
Speaker A
By the way, the name and password for that can be found in the password app on your Mac or iPhone. You definitely need to enable remote access and select password-based authentication.
10:38
Speaker A
Raspberry Pi Connect is not required. You can keep that turned off. Finally, check everything again, click on "Write ," confirm the security warning, and the data will be transferred to the SD card. For me, it only took a minute and
10:54
Speaker A
then the SD card was ready. You can then close the Raspberry Pi Imager. Insert this microSD card into your Raspberry Pi. If your Pi has a network port, you should plug it into your router now, then connect the power
11:09
Speaker A
supply. On the Raspberry Pi Zero, it must go into the lower micro USB port, which is labeled "Power." A monitor, mouse, and keyboard are not necessary.
11:19
Speaker A
On a monitor, you would only see a few boot messages anyway. Exactly, now is the right time for a small hot drink.
11:28
Speaker A
It will take about 1, 2, 3, 4, 5 minutes. On your Fritzbox, the new adblocker will appear under "Home Network." Here you can see its IP address, and you can also set it to always keep the same IP address on your
11:43
Speaker A
network. We will do the rest of the installation on the Raspberry Pi, and since no monitor, mouse, or keyboard is connected, you simply log into the Raspberry Pi via the terminal. But don't worry, you only need a handful of
12:01
Speaker A
commands, all of which I will show you now and include in the video description. So, open the Terminal utility on your Mac or the command prompt on your PC, and log in using the command "ssh admin" via the hostname "
12:17
Speaker A
@blocker". The IP address of the box. You must confirm the first login by typing "yes" and pressing Enter to show that you trust this computer. Now you can enter your login password. By the way, it won't be displayed, so just
12:33
Speaker A
press Enter again and, voila, you are logged into the Raspberry Pi. That wasn't so hard, was it? We'll start off nice and easy. To warm up, we'll install the updates first. Use the command sudo apt update to download the
12:47
Speaker A
list of all available software updates. They are then installed with the command sudo apt upgrade-y. This might take a little while. You might need to press Enter occasionally. Sometimes it is also necessary to restart the Raspberry Pi. The command for such a
13:07
Speaker A
restart is sudo reboot. However, this will also disconnect your connection to the Raspberry Pi. This means you have to log in via SSH again afterwards. And now you install Pi-hole. And that actually works with just a single command, which you copy from the
13:24
Speaker A
official website. You then paste it into the terminal and press Enter. And now we have to answer a few questions and press Enter again from time to time . Pi-hole needs a data source for all the IP addresses, the so-called
13:40
Speaker A
upstream DNS server. Google is set by default. If data privacy is important to you, choose Quad9 instead. Pi-hole works with blocklists that specify which addresses should be blocked. If you select Yes here, the recommended list by user Steven Black will be
14:00
Speaker A
loaded. I would generally turn off query logging so that not every DNS request is recorded, and set FTL to anonymous mode as well. After that, the actual Pi-hole installation starts.
14:17
Speaker A
Afterwards, you will see a summary with all the important information, e.g., which address to use to open Pi-hole in the browser and which password you need for logging in. I absolutely agree; it's a really good idea to save all
14:33
Speaker A
this info somewhere, as a kind of network documentation, e.g., by just copying it and pasting it into a new note. Once you've done that, open Pi-hole in your browser and log in with the password. There's not much going on
14:50
Speaker A
yet, as Pi-hole isn't being used as a DNS server yet. It isn't receiving any requests, but you need to make one very important setting here. In the sidebar, click on DNS, enable expert mode, and there you will find the option to set
15:06
Speaker A
Permit All Origins. Only with this setting will Pi-hole answer DNS requests over your Tailscale VPN, and we'll set that up next. The official website has a wonderful guide on how to install Tailscale for Pi-hole. Simply copy the first installation command,
15:28
Speaker A
paste it into the terminal, and press Enter. After installation, copy the second command. Then do exactly the same thing, and Tailscale will start on the Raspberry Pi. Copy the displayed address into your browser, and use it to add the Raspberry Pi to your secure
15:47
Speaker A
Tailscale network, or your tailnet. In the Tailscale console in your browser, you should disable the security key expiration for the ad blocker using the "Disable Key Expiry" option. Then, copy the VPN IP address of the ad blocker, which is the Tailnet IP. In the DNS
16:09
Speaker A
section, use it to add a new DNS server . You just need to activate it using the "Override DNS settings" option.
16:18
Speaker A
Congratulations, you've now built your own ad blocker, but are you actually allowed to use it? If you turn on Tailscale, not only do the ads in your browser disappear, but so do the website's ad revenues. Nobody likes ads
16:38
Speaker A
, but for most people, it's the lesser of two evils and the business model for many companies. I am not a lawyer, I am an admin. However, the Federal Court of Justice has ruled that offering ad blockers is completely legal, because
16:57
Speaker A
advertisers are capable of defending themselves against them. For example, ask duden.de how "ad blocker" is written, and you will be prompted to turn yours off first. So, just deactivate Tailscale and you can use Duden again. An ad blocker might be
17:17
Speaker A
legal, but it can violate terms of service. Pi-hole also doesn't filter out all advertising. You won't get rid of YouTube ads with it, because the ad spots come directly from YouTube. But maybe you noticed something in this video. For a few days after publication
17:36
Speaker A
, I will turn off the ads during this video. As my loyal subscriber, you had fewer ad interruptions this time. For me, this is an experiment that could backfire, because I am depriving not only myself but also YouTube of ad
17:52
Speaker A
revenue. By the way, if you want to know how you can even save on TeamViewer costs with Tailscale, then feel free to watch the next video here.
18:02
Speaker A
Thanks for watching until the very end. Bye.
Topics:DIY ad blockerPi-holeRaspberry PiTailscalead blockingVPNhome networkprivacywireguardtech tutorial

Get More with the SozAI App

Transcribe recordings, audio files, and YouTube videos — with AI summaries, speaker detection, and unlimited transcriptions.

Or transcribe another YouTube video here →