In this video, I'm going to show you how you can turn your Raspberry Pi into a device that
will block online ads across your entire network.
All you need for this tutorial really is the Raspberry Pi itself and let's just get started.
So you'll need the Raspberry Pi IP address for this tutorial later on, so let's just
get it now and then we can save a little bit of time later.
So what you can either do is, when the Raspberry Pi boots up if you're not going to use SSH
you can see the IP address on the screen and if you don't see it you can just log in and
in the terminal just put "hostname -I" and then that will show the IP address.
But let's say that you can't actually log onto the Pi directly and you're running it
headless, then you can still find out the IP with command prompt.
So if we just start up the run box by pressing the windows key and R, type in "cmd" and then
just type in "ping raspberrypi.local".
This will then resolve the Raspberry Pi hostname on the network and as you can see the IP address
for my Raspberry Pi specifically is 192.168.0.171.
So we'll remember that for later in the video.
But let's just get started by installing Pi-Hole onto the Raspberry Pi, so I'm just going to
log in to the Raspberry Pi over SSH.
You don't have to do this, you can just log in directly, but I just find this more convenient.
So here we are on the main terminal screen for the Raspberry Pi.
There's only one command that you actually need to put in to install Pi-Hole onto the
Raspberry Pi, and that is "curl -sSL https://install.pi-hole.net | bash".But there will be all the commands
that you need and everything in the article that is linked below if you just want to copy
and paste the commands.
So we'll press enter, as you can see we have a Pi-Hole logo that has appeared on the screen.
So just whilst this is happening, I'm going to explain a little about what Pi-Hole is
and what it does.
So what Pi-Hole will do is it will turn your Raspberry Pi into a DNS server so it will
turn any device that you point to the Raspberry Pi, such as your router or specific devices
such as computers and phones.
For DNS queries, it will point them towards the Pi and then the Pi-Hole system will take
care of that.
So what's great about this is that because Pi-Hole is only doing DNS lookups and things
like that and just acting as a DNS server, it won't actually throttle the bandwidth of
your internet connection or your LAN connection since it's just acting as a DNS server.
So essentially, what that's doing is when you're browsing to a website, it's obviously
taking the URL and performing a DNS lookup on it so if you go to richardtech.net it's
going to try and resolve the IP address that is linked with the domain name and so when
you're on the site and it's loading things such as videos, images.
Once it gets to an ad and it's trying to resolve the IP address for that, it's going to go
to Pi-Hole for the lookup on the DNS and Pi-Hole is just going to be like this is in one of
the listed ad servers that are in their record and it's just going to return nothing and
therefore it's going to block the ad.
What's great about this is that you can do it on any device on your network that's pointing
its DNS server towards the Raspberry Pi itself and then it will also free up resources on
the client so you won't have to worry about resources being used by ad blocking plugins
because everything is being handled by the Pi.
So as you can see now, it's just going and creating this checklist that you can look
at as it's installing and configuring things, and by the looks of it, everything is almost
done.
It hasn't been a super quick process but obviously, it is a... it's done.
So as you can see, we have the IP address info on the screen.
It says if you're going to change the IP address of the Pi, you need to restart the Pi.
It's also telling you where the admin interface is, so we're going to take a look at the admin
interface now and it's also got the password displayed there which you can use to log in.
So what we're going to do is go to the Pi-Hole log in screen.
As you can see it's got the web interface listed here so let's just go to "http://pi.hole/admin",
and that hasn't worked.
If that doesn't work, we're just going to try the alternative which is "http://192.168.0.171/admin"
and there we go, that has worked.
Here we can see the main Pi-Hole interface, so 24 queries so that's the total amount of
lookups that are happening, blocked queries, and then also domains on the blacklist which
is one-hundred and twenty-three thousand and this is malicious domains, ad domains and
stuff like that.
Here on the sidebar, you can see we've got a lot of different options.
So you can whitelist domains, so they don't get blocked and there's also a blacklist so
you can block domains.
You can see you can disable Pi-Hole permanently if you want to or enable it there so if you
are having issues with stuff you can disable it for a certain amount of time.
Here are some tools to update your lists and block lists and stuff like that.
In your main settings here there is a bit of information about the Pi.
You can clear settings, restart the Pi itself and stuff like that.
So, let's just go onto the dashboard and let's change the DNS settings on this computer so
this will be for Windows specifically and I'm just going to show you what happens when
we try to load a website that has ads on it.
Let's just go onto "Change adapter options" then you're going to need to pick the right
network card, so I'm using ethernet but if you're using Wi-Fi pick the right setting.
Then I'm just going to go onto "Properties", then look for "Internet Protocol Version 4"
and then here change your DNS settings.
So, you're probably going to be on automatic settings by default, just click use the following
DNS server addresses and in here we're going to put in "192.168.0.171" which is the IP
address of the Raspberry Pi and then as a backup DNS server in case the Pi is offline
or having issues, you can set "8.8.8.8" which is Google's DNS settings.
We'll click "OK" and what should happen is if we go to "richardtech.net" you can see
that there is no ad here.
So if we go back to here, we can see, here's my computer's IP address, and you can see
the requests which have gone up, queries have been blocked and so if we refresh this page
we should have a nice graph slowly appearing.
As you can see, here are all the different sites that are being requested and here are
the blocked sites here.
But, as you can see that's pretty much it.
So ads are being blocked, you can set custom DNS settings on your phone for example and
add it in or do it on your router and that will block it across your entire network.
But that's pretty much how to block ads across your entire network with a Raspberry Pi.
That's been it for this video, thanks for watching and I will see you in the next one.