PDA

View Full Version : How To Install Pi-Hole in Windows via Hyper-V & Debian (network wide ad-blocking)



WhiteGoblin
03.04.17, 21:40
Hello everybody! First off, much love to Anon & all the developers here.

I know I don't post often but I've came back to follow up my video I did on properly installing the Vuze Extreme mod. Though this time 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 instead of just dropping a video link I'll also include a bit of a write up as well. 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 (https://pi-hole.net/) 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 (https://en.wikipedia.org/wiki/Hyper-V#Supported_guests) 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 versions of Windows this is now 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 (https://www.debian.org/CD/http-ftp/) distro. (make sure to download the appropriate version for the machine you're running on, for example, a modern computer will require the amd64 (http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/) 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 (https://www.reddit.com/r/pihole/comments/634pi3/how_to_install_pihole_in_windows_via_hyperv/) 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. While not P2P related I was sure you would all appreciate this so I thought I'd drop by and post it. Do not be scared this is extremely easy to do so I'm happy as well to be showing how simple it can be to setup.

If still interested you can view the video tutorial on YouTube:


https://www.youtube.com/watch?v=DgUZ9fccBCU]https://www.youtube.com/watch?v=DgUZ9fccBCU

Much love,

'Goblin

austinpowers
08.04.17, 23:49
interesting concept that pi-hole is. too bad it is quite complicated and too many steps to install on Windows. the benefits seem arbitrary compared to all the work put in just to get it to work. changing DNS servers and running unverified scripts seem risky as well.

however, thanks for sharing.

anon
10.04.17, 07:02
changing DNS servers and running unverified scripts seem risky as well.

As long as you follow the tutorial, you should be fine. However, I think the perfect usage scenario for this would be running it on a Linux box that was already operating as your router (always on, no additional power consumption, no virtualization overhead), rather than a virtual machine inside a Windows workstation.

If you need a lightweight alternative, try Acrylic DNS Proxy (http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome) combined with some ad-blocking hosts file.

WhiteGoblin
23.04.17, 02:38
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. :)