How To Block Ads On Your Entire Network

in #technology6 years ago

pihole.png

Many people use an ad blocker like uBlockOrigin to block ads from tracking us around the web but this only works on the devices it is installed on. We can do one better and prevent them all across any network in our control.

Method 1: Hosts file.

This method has the least overhead of the two and is great if you just want to get something up and running. Ideally, you would want a separate device to, but you can do this with any computer.

Every computer has a hosts file that holds data for converting domain names to their IP addresses. When you open one for the first time, it is pretty bare, and all requests get directed to your router for lookup.

  1. Log into the computer or device you want to use as your new DNS server. I am using a Raspberry Pi 2.
  2. Open Steven Black's Hosts Git Repo, scroll down, and find the file that works best for you. I am using the Unified Hosts + Porn. Click the link to the "Raw Hosts File," and you will see an enormous list of domains.
  3. Open your hosts file
    a. Linux & Mac OS X: /etc/hosts
    b. Windows %SystemRoot%\system32\drivers\etc\hosts
  4. Copy and paste the raw text from step two into your hosts file. You can overwrite the file or create a symlink if you want. The file hosted on Github has all the bits required it the hosts file.
  5. Log into your home router.
  6. Find the IP address of the device you just added the hosts file too
  7. Copy this address and set is as your new DNS server for your router. (I can't walk you through this because they are all different.)

That's it! Now you have a network level ad blocker!

Continue Reading on jrswab.com

Sort:  

Thanks for this detailed description (tutorial) on how to set up a network adblocker. Privacy is almost nonexistent these days, we need all the help we can get to combat the information thieves! I have a Pi for running Kodi right now.

I totally agree! You should be able to run the Pi-Hole along side kodi but make sure to double check that to be sure.

Nice blog post! I use pihole too - I enjoyed your description and references. I will check out some of the lists you mentioned.

Very cool man! Feel free to message me on Matrix/Riot if you want to chat more about this kind of stuff.