How to block ads on your network with the Raspberry Pi
About: You can use your Raspberry Pi as a DNS server which blocks ads on all your devices connected to your network. This means your Iphone, Android phones and Ipads can now block ads without needing to root them or do any changes to them. We’ll be using Pi-hole to put on our Raspberry Pi and the install is very simple. I will be using a dedicated Raspberry Pi with a clean install of Raspbian on it. If you are using your Pi for anything else like a web server or have edited the DNS settings then the install may break your setup. I would recommend setting up your Pi-hole on a clean install to prevent anything like this from happening or backup your Pi before running the install.
Objective: To demonstrate how to set up our Raspberry Pi as a DNS server that blocks ads on all devices network wide.
Material: You will need the following:
Instructions: Installation of Pi-hole is very simple. Start off by simply typing the following command in the terminal
curl -L install.pi-hole.net | bash
This will begin the download and installation. After a while you should get a few prompts about whether you want to set your Raspberry Pi to use a static IP. Make sure you select Yes. A static IP will keep the same IP address on the Raspberry Pi after you restart it. This will be important when we set up the router in a few steps. We’ll be setting the router to point it’s DNS to our Raspberry Pi, and if the IP would change then our DNS would not work.
Keep clicking Next until you get a prompt about which protocols to use for blocking ads. Make sure you select IPv4 and IPv6. Use the space bar to select both options. Many ads are now using IPv6 and we need to make sure to block them for maximum efficiency.
That’s pretty much it. You’ll get the following screen when you’re done.
Make sure you copy down the IP address. We will be using this in the next step to set up the router. Now everyone has a different router. I will show you how to set the DNS on my Netgear router, but it should all be similar for each router. Go ahead and login to your router. The IP address is usually 192.168.1.1 After logging in find your Internet Setup. You should see something about DNS settings. Make sure to select “Use these DNS servers” or something similar and setup the first IP address to the IP that you wrote down from before for your Raspberry Pi. The second DNS IP address set it as ‘184.108.40.206’. These are Google’s DNS servers and in case our Pi is not working or turned off everything will route through Google’s DNS servers, so we shouldn’t see any hiccups when using the internet, like seeing ads again.
That’s it. You should now be able to surf the web and see if your ads are blocked. If it’s not verifying your DNS settings on the router may not be set to the Raspberry Pi’s IP address. You can also view your Pi-Hole statistics by going to your Pi’s IP address/admin. For my example I would go to http://192.168.1.18/admin and I would see the following screen.
If you have any questions or concerns then just comment below. Also please donate to the Pi-Hole project here: http://pi-hole.net/donate/