Arul's Space


Modern browsers bypass Local DNS 🖥 🔗

Feb 10, 2025

Local DNS
×
How I Struggled with Pi-Hole, Switched to DNSMasq, and Finally Found a Solution for Blocking sites & Ads on My Devices

I’ve always been intrigued by Pi-Hole’s promise to block ads and make browsing faster. So, I dove into setting it up, following all the instructions, configuring it with my router, and hoping to finally be rid of annoying ads across my devices. But when I checked, something wasn’t right. Despite everything being set up properly, Pi-Hole wasn’t working. None of my devices were getting the ad-blocking benefits I had expected. I was confused and frustrated, but little did I know, I was facing a deeper issue.

The Struggle with Pi-Hole Not Working

After going through the setup multiple times, I realized that Pi-Hole wasn’t blocking ads on any device. I thought it was just a misconfiguration, so I tried again, rechecked the router settings, and even reinstalled Pi-Hole. But still, nothing changed. That’s when I started reading more about the issue, and here’s what I found: modern browsers have been designed in a way that prevents them from using the DNS settings you configure on your router. This is exactly why Pi-Hole wasn’t blocking ads, even though everything seemed set up correctly. It wasn’t just a Pi-Hole issue – it was a bigger problem with how browsers are handling DNS these days.

Moving to DNSMasq – Still No Luck

Not giving up, I decided to try using DNSMasq, which is a lightweight DNS forwarder and DHCP server. It promised more control over DNS, so I thought this might solve my problem. But, as I started testing it, I ran into the same issue: browsers weren’t using the local DNS settings anymore. It seemed like I couldn’t win. And then, I stumbled across something that completely changed my perspective: DNS over HTTPS (DoH).

DNS Over HTTPS: The Real Game Changer

I started learning about DNS over HTTPS (DoH), and it made everything click. DoH encrypts DNS requests by sending them over HTTPS, which improves security and privacy. But here’s the kicker: it also messes with unencrypted local DNS-based ad-blocking methods completely bypassing any local DNS settings you’ve configured.

It turns out that Firefox was the only major browser offering this DoH feature – but only on desktops, not mobile or other devices.This explained why Pi-Hole and DNSMasq weren’t working. Even if I had configured everything properly, Firefox’s DoH was simply bypassing my local DNS entirely.

The Classic Solution: Using the /etc/hosts File

After facing all these roadblocks, I thought back to an old-school method that has been around for years: editing the /etc/hosts file. By manually adding entries to the hosts file, I could block known ad servers by redirecting them to a non-existent IP address. This approach is super reliable and works perfectly on desktops and laptops.

Here’s the catch: while this method works great on desktop operating systems, mobile devices don’t give you the same level of access to the hosts file. So, unfortunately, this isn’t a solution for mobile users, but it still works wonders on laptops and desktops.

Final Thoughts: The Reality of website Blocking in the Modern World

In the end, I realized that blocking ads and unwanted content on modern devices is more complicated than it used to be.

Pi-Hole and DNSMasq are great tools, but modern browsers make it harder for local DNS settings to work. That’s why the /etc/hosts file is still one of the best ways to block ads, social media and adult content on desktop computers and laptops. It may be a manual process, but it works 100% reliablyi. and I can easily automate that with a script.

For now, it’s back to the basics with the hosts file – and it’s working just fine for me on my desktop. Sometimes, the simplest solutions really are the best ones.