How does Pi-hole work?


#1

To understand how Pi-hole works, it’s helpful to have a basic understanding of what happens when you visit a Website in your browser. But in a sentence:

Pi-hole intercepts requests for advertisements and prevents them from being downloaded

About this FAQ

This article is meant to be a high-level document that attempts to avoid as much technical jargon as possible.


To keep things simple, I will describe a basic task, like visiting a Website. Using those same steps, I will:

  1. describe what happens normally
  2. describe how a traditional ad blocker (like Ad Block Plus) modifies this normal behavior
  3. describe how Pi-hole modifies this normal behavior
  4. contract how Pi-hole differs from traditional ad blockers

What normally happens when you visit a Website

When you want to visit a Website, you would:

  1. open a Web browser
  2. type macworld.com (or some other Website) into the address bar
  3. press Enter
  4. watch the Webpage load on your screen
  5. watch the advertisements load as well

What is happening when these steps are taking place?

  1. open a Web browser
  • not much happens here; it’s just your interface for accessing Webpages
  1. type macworld.com into the address bar
  2. press Enter
  • the query macworld.com is sent to a server to find out where it is located
  • think of it like like a phone book–computers understand numbers, not words, so a server needs to look up what number belongs to macworld.com and then tells your computer where to find it
  1. watch the Webpage load on your screen
  • now that your computer knows where the server is, it begins downloading the Webpage
  1. watch the advertisements load as well
  • most Websites are complex and actually load files, images, and videos from other places
  • so even though you only wanted to visit macworld.com, in the background, your computer is also asking a server where to find other domains like doubleclick.com, b.scorecardresearch.com, or images.techhive.com
  • often, these other domains are services used to display ads when you visit the webpage
  • so when you visit macworld.com, your computer is actually also visiting several other domains and downloading information from all of them

How does a traditional ad blocker block these ads?

Using the same steps, I have included information on how traditional ad blockers work

  1. open a Web browser
  2. type macworld.com into the address bar
  3. press Enter
  4. watch the Webpage load on your screen
  • your computer will still download macworld.com, as well as the other domains mentioned previously
  1. watch the advertisements load as well
  • even though the ads were downloaded, the browser plugin will just hide these from your view

How does Pi-hole block these ads?

1. open a Web browser 2. type macworld.com into the address bar 3. press Enter - **Pi-hole looks up macworld.com and begins downloading it, but it will detect the domains used to serve advertisements and instead of looking up the real address of those sites, it will send a fake address instead** - **this allows the _legitimate_ content on macworld.com to load, but _prevents_ the ad images and videos from being downloaded** - **this is a _critical_ difference between Pi-hole and traditional ad blockers because Pi-hole will prevent the ads from being downloaded in the first place (making the Webpage [load faster](https://discourse.pi-hole.net/t/will-pi-hole-slow-down-my-network/2048)).** 4. watch the Webpage load on your screen - **your computer will still download macworld.com, but _not_ any domains that appear on the blocklist** 5. watch the advertisements load as well - **since the ads were not downloaded in the first place, they do not need to be hidden from your view since they do not exist in the first place**

No internet on some devices after setting router to use Pi Hole as DNS server
Why won't Pi-hole work with DNS rebind protection enabled?