Creating a network-wide ad-blocker using Pi-hole - Part 2
In a previous post we saw how blocking certain domains can help mitigate adverts and some tracking whilst surfing the world wide web. In this post it will be shown how it is possible to block these domains with a Raspberry Pi running software called Pi-Hole.
What is a Raspberry Pi and why should I use one?
While Pi-hole can be installed on any big 'ole computer that pulls a lot of power and costs a lot of money, it makes more sense to install it on a smaller device that comparatively sips power and costs a lot less. Pi-hole does not require a lot of computational horsepower to work, but will need to be on 24/7 this is where a Single Board Computer (SBC) like a Raspberry Pi comes in.
A Raspberry Pi is a SBC which can be thought of as a very small, power efficient computer. At the time of writing, there are three different models currently in production and available. These are the Raspberry Pi 4 model B, the Raspberry Pi Zero W and the Raspberry Pi Zero v1.3. For ease of installation and use as pi-hole device it is recommended to use a normal Raspberry Pi for following this guide as it has a built-in network port, and the reliability of wired Ethernet as apposed to WiFi will cause a lot less head aches. If you are more tech-savy and confident, you can use a Pi Zero and get a usb to ethernet device. You could also look into installing it as a docker container.
Before installing Pi-hole on a Raspberry Pi, it is assumed that Raspbian is already installed and running on the device. For instructions on how to install Raspbian as a new user to Raspberry Pis, please look at this documentation page.
Once your Raspberry Pi is up and running with a fresh install of Raspbian you can simply run the following command in a terminal to get an interactive installer started:
curl -sSL https://install.pi-hole.net | bash
Please note, it is not usually recommended to blindly run a script using from the internet unless you fully trust the source. To first check the scripts contents before running you can use wget:
wget -O basic-install.sh https://install.pi-hole.net
You can then use your favourite text editor to look at the contents of the script:
If you are happy you can then run the script as sudo:
sudo bash basic-install.sh
This should guide you through the setup process for Pi-hole. A couple of things to consider are:
- - The IP address of the device should be static, the installer should take care of this.
- - The upstream DNS servers can be any public one you care for, I would recommend staying away from google's though.
- - Some IOT devices have hard coded DNS servers, there is not an easy way to get past this, apart from forwarding all outgoing DNS requests to Pi-hole, that is a bit beyond the scope of this guide though.
After installing Pi-hole the devices on the network will not know to use it as a DNS server unless otherwise told to. To change this it is required to change the DNS settings of your router. Each router will be different but the option should be available under DNS or DHCP settings. If there is no such option, you may have to set the Pi-hole device to be your DHCP server as explained here, and as a last ditch procedure you can assign the Pi-hole as the DNS server on each device which is connected to the internet. This will vary device by device and be a very laborious process.
If you need more information about installing and using Pi-hole I recommend looking through their documentation, forum and their subreddit. Or you can comment down below and I will try to help in any way I can. Look out for more blog posts in the future about further securing privacy in DNS requests using Stubby.
Post a comment