Adventures in Homelab: PiHole & Recursive DNS
I just love tinkering with my homelab. When I finally got my hands on a Raspberry Pi (Thanks chip shortage for making that an adventure!) I threw myself at it. The first thing I did was set up PiHole and give it a recursive DNS. Now, let's back up. What's a Raspberry Pi, what's PiHole, and what is a DNS (much less a recursive DNS!)? Let's give you a short and easy synopsis of each.
A Raspberry Pi is an invention of Eben Upton of the Raspberry Pi Foundation. It functions as an extremely cheap and small computer. See for yourself in the
image below--this thing is all purpose and no form. Completely stripped of the excess to deliver exactly what it aims to do: a cheap computer. Upton created the device for this purpose exactly. He saw that students were moving away from programming, and thought he could remedy this if he made the price of entry more accessible. It seems to have worked (judging by how hard these are currently being scalped on Ebay!). They can run as cheap as $30 MSRP, depending on the model and configuration.
So what is a PiHole? A PiHole is a program you can install on a Raspberry Pi (for instance) that acts as a Forwarding DNS Server. Not a very helpful explanation if you don't know what DNS is. Let's break that down too. A DNS (Domain Name System) server is the way your computer knows how to get to a website when you type the name into an address bar. For instance, let's say you type in this blog https://techspeczack.blogspot.com into your address bar of your browser. You hit enter and you are delivered to the page. How did that happen? Do the Internet and computers know English? Not exactly.
Computers speak in Binary. That is to say, 1's and 0s. Further, websites and devices are identified by their IP addresses (For instance, IP version 4 would be something like 192.168.1.1. That's not 1's and 0's, but it's also not alphabetical, so how does your computer get there by you typing the name of the website in? Well, through a DNS server. A DNS server functions as something of a translator and a roadmap all in one.
When you type in www.google.com, your computer sends a message through and out of your network to a DNS server. It says, "Hey, I'm looking for Google...can you help me get there?". The DNS says, "No problem! That's IP x.x.x.x!". Your computer gets that IP, and then it takes you to www.google.com.
So what is a Recursive DNS, and why did I install a PiHole? Well, a recursive DNS acts as a local DNS. It holds a vast library of built in websites by default, so it doesn't need to always ask a bigger domain server for the IP info. If you do end up typing a website in that isn't in that library, it simply goes and asks a DNS server like normal. What's the point of all of this? Well, it has two main objectives (And plenty more besides):
Firstly, less ads. The websites built into the Recursive DNS are specifically not advertisement websites. So when you type in a website, it loads that
website..but it does not load the ads along with it (since they weren't in that library!). Secondly, it provides security. A common tactic used to infect your
computer with malware is to spoof a website's name and attach a different IP to it (referred to as DNS Spoofing). This means that when you type in, say,
google.com...you are no longer going to that webpage's IP. It may look and function exactly the same, but this is a guise. In reality someone, in this
pretend scenario, has taken you to a different website entirely that has malware embedded within it to infect you with.
The recursive DNS prevents this by blocking these websites by default, since they are not associated correctly within their library. Best of all? These benefits are applied to all devices on your network! Neat, huh? For a fantastic guide on how to set up your very own PiHole, check this video out.
Comments
Post a Comment