Jump to content

How To Install Pi-Hole in Windows via Hyper-V & Debian (network wide ad-blocking) (video included)

Sup LTT! So I created a short video tutorial (9 minutes in runtime) covering the installation of Pi-hole in the Windows operating systems via Hyper-V & using Debian Linux. This provides network wide ad-blocking as well enhanced security via DNS redirection, completely for free. You gotta keep in mind this works across your entire network; so phones, tablets, gaming consoles, smart televisions, etc. all benefit from this. It also has a pretty sweet web based GUI that you can use for blacklisting domains, looking up queries, checking on your clients, etc. Can make network management much easier depending on what type of setup you might be using. I tried to be as straight forward as possible & also put study aids on the screen throughout the process so that you don't have to try to see the tiny text I'm typing in as it's happening. This is not a process you should fear & is extremely easy to do, it delights me to be able to show off the ease of install inside nine minutes.

 

Though I looked up the community guidelines and they specifically say I can't post this video I've made without; "2 - The video is only to complement your complete, written post on the site. You cannot simply post a video." So I'll include a bit of a write up as well to appease the mod gods! (or just Luke, I'm doing this to appease Luke) Now my default forum of choice on the net has been ArsTechnica for the last 18 years, so yes, you're going to see this posted over there too. I'm trying to share the love. Anyways back on topic, basically what we're doing here is opening up a hyper-v environment so you can run a copy of linux on top of your windows operation system. Why? So we can install Pi-hole which blocks over 100,000 ad-serving domains through a DNS redirect on your network. This has the included benefits of improving your network performance (since ads are blocked before they are downloaded altogether) & reducing your data usage if you happen to be on a bandwidth cap.

 

To start you'll need an operating system capable of Hyper-V. Wikipedia has a beautiful list of all the supported operating systems, so check if yours is on there. If so you can do this! If you can have it but don't have it installed, you'll need to go into your Control Panel, then to Add/Remove Programs. In modern windows versions this is called Programs and Features. From there, inside the new window that pops up, on the left side will be an option to "Turn Windows Features On or Off", this is where you need to go to install Hyper-V. Simply check the box next to it in the new window that pops up & follow the install prompts. Next on our journey you'll need the newest version of the Debian Linux distro. (make sure to download the appropriate version for the machine you're running on, for example, a modern computer will require the amd64 iso) Why do we need this? Because Pi-hole was originally meant to be booted on top a Raspberry-Pi and it's grown from there. Here we don't require a Raspberry-Pi, anything that requires money, or even physical objects beyond what we already own.

 

So now that we have Hyper-V installed & a fresh copy of Debian we begin. As shown in the video, you'll need to create a virtual switch first. This is very simple, just click the switch manager on the right & create a new one. Make sure to select your adapter that is currently supplying your internet connection. With that done we can simply create a new virtual machine, you really do not need beef settings to make this happen. It can be done on 1GB of ram & a single processor though like anything, it will benefit the more you open it up. In the video I gave the virtual machine 4GB of ram & 10GB of hard drive space, THIS WAS PLENTY. Make sure to select the Debian iso to be inside your virtual dvd drive when the machine is turned on. It's just like any other operating system install just much easier & faster. Once this is done we need to install Curl so that we can then install Pi-hole, we also need to make sure the machine is now on a static IP so that the other devices on the network always know where their DNS server is. I've actually put this on the screen in the video but if you're interested in reading it, the basic command process to this is:

 

su root
apt-get install curl
nano /etc/network/interfaces
    auto eth0
    iface eth0 inet static
        address 192.168.10.95 (your pi-hole static ip)
        netmask 255.255.255.0
        gateway 192.168.10.1  (your gateway)
reboot
su root
curl -sSL https://install.pi-hole.net | bash
pihole -a -p newpassword
set router manual DNS settings
  primary   = 192.168.10.95 (your pi-hole static ip)
  secondary = 8.8.8.8 (emergency google backup)
apply & push router changes across network
connect to 192.168.10.95/admin (use pi-hole ip)

 

As discussed in the video you're going to want to comment out the last two lines of "/etc/network/interfaces" before writing in your new static address. You're also going to want to select a static address that is outside of your DHCP lease range so that it doesn't accidentally get leased to another device if your Hyper-V happens to go down. Next as seen in the instructions above, we need to go into your actual router & change your DNS settings to point to the new Pi-hole installation. This will be your Primary DNS for your Secondary DNS we're going to use Google's primary server. Why? This is for emergency backup! If your hyper-v goes offline, you forget about it, or say, the machine it's running on is shut off altogether then your network will default to google instead of just going offline. Unfortunately there won't be any ad-blocking going on at that point but that's far better then everybody on your network being upset that there's no internet access. After this all we have to do is connect to the Pi-hole web interface via any browser. Just point your address bar at the static IP your Pi-hole is running on, drop a /admin after it & login.

 

You don't really need to do this, there's not many reasons to come over and manage the software. Mainly it's where you can investigate all the clients on your network, see problem areas, blacklist them, or even whitelist domains if you need to. You can see device temps here, charts, graphs, hella logs, you name it. It's a very simple but powerful interface that works extremely well. At the end of the video, after recording live, you can see it's running on only 700mb of memory. It really takes absolutely nothing to run Pi-hole an it has massive benefits for everything inside your network. That's why I wanted to share it with everybody! Anyways if you have any questions feel free to post though I am not associated with the project at all. I've posted this same video on their subreddit though if you happen to want to drop an upboat for me. (it would be appreciated!) I'm sure they would be much more qualified at answering in-depth technical questions then myself, though I will try my best to help out where I can.

 

If still interested you can view the video tutorial on YouTube: https://www.youtube.com/watch?v=DgUZ9fccBCU B|

Much love,

 

'Gobby

 

PS: Here you go Luke, that'll keep things interesting.

Link to comment
Share on other sites

Link to post
Share on other sites

I wonder how friendly it would be to integrate into a caching proxy.  I mean if I'm going to go thru this much effort, seems like caching wouldn't hurt.

There's something cool here - you just can't see it.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...

Here's a funny problem new comers might run into. Actually this directly shows something I could've explained better in my original post. A buddy of mine called and said he could not get this to work & he's following the guide perfectly. I asked him if Pi-Hole was getting traffic at all and he said yes it was, but nothing was getting to clients. I started at the beginning & walked through each step with him.

What it turns out he had done is left the secondary DNS empty instead of putting Google in there. I asked him why and he said that he didn't want there to be any traffic that could bypass the Pi-Hole so even if meant his network went down if the Hyper-V went down he would prefer it this way. Though the thing is, his router setup this way is just telling the Pi-Hole install when it turns on that it should route internet through itself. You're stuck in a loop. The secondary DNS to Google also functions to let the Pi-Hole Hyper-V establish a connection to the internet naturally. It'll turn on an say, whoa that first dns is me, sooo let's head over to Google.

The second he did this all the traffic started routing through the Pi-Hole correctly & out to his clients. One of those moments where I chuckled & apologized for not explaining that better though he was pretty bent given how much time he'd spent on it. So yeah, if anyone else on the internet had that same idea & got stuck in the same situation, there you go. ^_^

Link to comment
Share on other sites

Link to post
Share on other sites

with all this setup, if i restart my computer(or windows decides to update) since it would kill hyper-v, that basically drops internet for everybody doesnt it?

How do Reavers clean their spears?

|Specs in profile|

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

Link to post
Share on other sites

18 hours ago, Tsuki said:

with all this setup, if i restart my computer(or windows decides to update) since it would kill hyper-v, that basically drops internet for everybody doesnt it?

 

On 4/3/2017 at 2:14 PM, WhiteGoblin said:

...this will be your Primary DNS for your Secondary DNS we're going to use Google's primary server. Why? This is for emergency backup! If your hyper-v goes offline, you forget about it, or say, the machine it's running on is shut off altogether then your network will default to google instead of just going offline. Unfortunately there won't be any ad-blocking going on at that point but that's far better then everybody on your network being upset that there's no internet access.

Link to comment
Share on other sites

Link to post
Share on other sites

Just wanted to come back and let everybody know there's new versions of both Pi-Hole and it's GUI out! All you need to do is open your Hyper-V machine up, log into root, and type "pihole -up" to start the automated update system. ^_^

Link to comment
Share on other sites

Link to post
Share on other sites

  • 1 year later...

Quick question about creating a switch. Do I need to create one if I already have a virtual switch for the rest of my VMs?

Link to comment
Share on other sites

Link to post
Share on other sites

  • 11 months later...

when ever i try this i just get a message when i try to conect to the vm saying video remoting was disconected ? iv googled and cant find a solution that works so gave up and just went bk to host blocking

#1:- STRIX X470-F GAMING | Ryzen 7 2700X @ 42.50mhZ | Patriot Viper Steel Series 16gb (2x8) 4000 MHz | MSI RTX 2080 GAMING TRIO | ASUS ROG RYUJIN 240 | NZXT S340 ELITE | 2X 1TB 970 EVO PLUS M.2  +  3 X 1TB FIRECUDA 2.5" HYBRID DRIVES | EVGA SUPER NOVA G3 80+GOLD 1000W | AND ENOUGH RGB TO MAKE YOUR EYES MELT 

#2:- GIGABYTE X470 AORUS ULTRA GAMING | RYZEN 2700X | AURUS 3200MHz | MSI GTX 1060 6GB | CIT BLAZE MID RED-BLACK | STOCK RYZEN RGB AIR COOLER | 2TB WD HDD + 500GB 970 EVO PLUS

#3:- STRIX X470-F GAMING | Ryzen 7 1800X | DOMINATOR LPX 3000MHz | STRIX 970| COOLER MASTER 240 ML | GAME MAX AURORA MID TOWER | CRUCIAL P1 1TB SSD M.2 + FIRECUDA 1TB HYBRID DRIVE

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×