Live data from Hacker News

Setting up a Pi Hole made my home network faster

brianchristner.io

171–180 of 249 posts

Re: Setting up a Pi Hole made my home network faster

#172

Every time I've tried pihole it has failed on services like YouTube. Can someone explain this to me and how I solve it? I know it's not just me, it even happened to Linus Tech Tips but I constantly hear responses "works for me" which are unhelpful. If ublock works fine, why can't pihole? I'm actually interested in a technical answer.

When your device sends out requests to the internet, the vast majority of them are encrypted with SSL. SSL encrypts your requests so that middlemen can't inspect or change the content of your requests. Without SSL, anyone would be able to do anything with your data, which of course would be a massive security problem that just cannot happen. Unfortunately SSL also means middlemen adblockers (like PiHole) can't see or modify the contents of your requests either. The only way for PiHole to block requests is by using the only necessarily unencrypted part of the request: the destination IP address.

Without being able to read the destination IP address, all the middlemen between your device and your destination server, wouldn't know where to forward your request. Your request would never make it to its destination website. The destination IP address is retrieved when you access a website. When you type google.com into the address bar, your computer sends out something called a DNS request to something called a DNS server. That DNS server sends back the destination IP address for the website you're trying to access. This DNS request is unencrypted and so PiHole can simply intercept it before it leaves your network, check if it's an ad domain, and if it is an ad domain, send back trash data to your device instead. Your device, unable to retrieve the destination IP address, is now blocked from accessing that content.

To prevent people from being able to block their ads via DNS, Google hosts ads on domains which are critical to using their services. For example, YouTube ads might come from youtube.com. This way, if you block YouTube ads using PiHole, you are also blocking the entire YouTube service as well.

UBlock Origin and other browser-based adblocking tools are able to block with a more fine-grained approach because they live in your browser and don't have to worry about SSL.

Re: Setting up a Pi Hole made my home network faster

#174

Earlier quoted context omitted.

Been using this solution myself for a number of years. Works remarkably well. I do not even use DNS recursion or any remote DNS requests because I can load bulk DNS data into the proxy's memory. There is only ever one nonrecursive request to a localhost authoritative DNS server and the answer is always the same: the address of the proxy. Ironically perhaps, DoH outside the browser can be used to gather the bulk DNS d…

Chromecast products, in particular, will not work with self-signed certificates, and you can't adjust their trust stores.

I have an early one someone gave me and there was a custom ROM that one could flash that let one choose their own DNS servers.[FN1] I actually bought a Teensy 2.0 in order to install the custom ROM, but I never got around to doing it. So now I have an old Chromecast and a Teensy 2.0 I am looking to make use of.

TBH, I always found the Chromecast proposition to be unreasonable: "Look at this neat form factor single board computer you just paid for. Too bad only Google is allowed to have control over it. Sorry, you cannot use this for your own projects because [unspecified]. Google must be allowed to conduct surveilllance and gather data." By comparison, lack of complete control over the RPi GPU is rather easy to ignore. AFAIK, the RPi Foundation is not selling online ad services. Compare the number of cool projects people have done with the RPi versus the Chromecast.

1. I think it used to be possible to force use of different DNS servers via DHCP as well.

Re: Setting up a Pi Hole made my home network faster

#175

Earlier quoted context omitted.

Pihole only works if ads are served from a distinct domain name from content. This works in most cases but YouTube serves ads and content from the same place so pihole can’t prevent. As uBlock works client side it does not face this limitation

So wouldn't there be a way to intercept the data and apply the same blocking that uBlock does and then resend it? I know it would have a delay, but that'd probably be worth it to me tbh.

It would be very hard to do so because SSL prevents middlemen from intercepting and modifying data. You'd have to install custom SSL certificates on all devices connected to your network like businesses do. PiHole would then use a copy of that custom certificate to decrypt the SSL, inspect/modify the contents, re-encrypt the contents with a normal SSL certificate, and send it off to its final destination.

I've looked into this and it seems like there is no software out there that makes this easy. For it to be convenient enough to make sense, I think there would have to be some router 'login' page which makes downloading and installing the certificate as easy as possible. But, even 'easy as possible' would probably be too inconvenient for any guests who just want to use your wifi. Maybe it could be optional somehow. Don't install the custom certificate? Fine but you'll still get ads. Install the custom certificate? Awesome, your ads will be blocked.

Re: Setting up a Pi Hole made my home network faster

#176

Earlier quoted context omitted.

Not sure about now, but before I'm using pihole, I was using hosts file to block ads and found a significant increase in network latency. Turns out the huge hosts file significantly increased DNS lookup time in my system (>1 seconds).

"I was using hosts file to block ads and found a significant increase in network latency" I ran in to a similar issue on Windows, which is described here: [1] After following that article's suggestion to disable the Windows "DNS Client" service name resolution returned to normal. [1] - https://tinyapps.org/blog/201809300700_large_hosts_file.html

It was on mac. I guess it didn't go as bad as windows, but still pretty bad.

Re: Setting up a Pi Hole made my home network faster

#178
post #69

I keep seeing posts about Pi Holes and it looks good, but I have previously dealt with ads by appending their delivering sites to my /etc/hosts, i.e. 0.0.0.0 trashsite1.com 0.0.0.0 trashsite2.com The only downside I see is that my approach is not network-wide. Any other reasons I should reconsider?

Similarly, why is PiHole better than using a browser ad-blocker?

Ad blocker extensions only block ads on the browser they're installed. Pi hole would block ads on all devices they're connected in, in all apps (not just web browser) as long as the ad domains they requested are in the blocklist.

Also, ublock origin can only protect you from CNAME cloaking (a commonly used to evade ad blockers) on firefox. It can't protect against CNAME cloaking in chrome or other browser. But pihole can.

You should still install an adblocker in your browser though as some ads are loaded from the same domain they're serving site contents from, such as youtube ads. Ad blockers can remove ads based on full urls, not just domains.

Re: Setting up a Pi Hole made my home network faster

#179
post #91

I found this basically only helped for laptops. Our phones and smart devices all use either DoH or hardcode a specific DNS resolver. I haven't spent the time going all the way down to re-routing all port 53 traffic, but I doubt it'll do much. To me the future of the home network is largely dead as long as I can't reasonably manage the software on these devices.

I'm not sure about Android, but you can disable iCloud Private Relay by returning NXDOMAIN for the domains below. These are Adguard filtering rules, but you can configure something similar using dnsmasq or Pihole.

  ||mask.icloud.com^$dnsrewrite=NXDOMAIN;;
  ||mask-h2.icloud.com^$dnsrewrite=NXDOMAIN;;
  ||mask-api.icloud.com^$dnsrewrite=NXDOMAIN;;
  ||mask-t.apple-dns.net^$dnsrewrite=NXDOMAIN;;
  ||mask.apple-dns.net^$dnsrewrite=NXDOMAIN;;
  ||mask-api.fe.apple-dns.net^$dnsrewrite=NXDOMAIN;;
I use these to automatically disable iCloud private relay, and I also have rules on my edgerouter to force certain devices to use my adguard instances for port 53 traffic, and it works well.

Re: Setting up a Pi Hole made my home network faster

#180

Every time I've tried pihole it has failed on services like YouTube. Can someone explain this to me and how I solve it? I know it's not just me, it even happened to Linus Tech Tips but I constantly hear responses "works for me" which are unhelpful. If ublock works fine, why can't pihole? I'm actually interested in a technical answer.

Pihole only see dns query. It doesn't see the full url. On the other hand, ad block extensions can see the whole url and can decide to block them while allowing other requests to the same domain through.

I think you should install both though. Pihole can block ads on apps, and can block CNAME cloaking.

Post reply on HN