Jump to content

Getting rid of ads and speeding up browsing


Jeremy Harris

Recommended Posts

Recently I stumbled across a neat little project called Pi-Hole (https://pi-hole.net/  ).  In essence, this uses a Raspberry Pi (any variant) to send all ad requests on your home LAN to a blackhole.  Websites you visit won't know you're blocking ads, either, so won't throw a wobbly.

 

I decided to install it on a spare Raspberry Pi Zero this morning, the very cheapest Raspberry Pi you can get (currently less than £5).  Pi-Hole doesn't need anything other than a very minimal operating system, so I loaded Diet Pi, (https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9 ).  In addition to a Pi Zero a µSD card is needed (I used a spare 8Gb one I had, but 4Gb would be more than enough), plus a 5V power supply with a µUSB lead and a cheap USB to Ethernet adapter.  The Pi Zero connects to a spare router port with an Ethernet cable, via the USB to Ethernet adapter.  Speed doesn't matter, as all the Pi-Hole does is deal with DNS requests.

 

Getting Pi-Hole up and running was easy, just run the script and let it do it's thing, then change the default login password and note down the IP address that the Pi Zero is using. 

 

You then just log in to your network router and change the default DNS IP address to the IP address of the Pi Zero.  You can have a safe back up by setting the secondary DNS IP address in the router to something like 8.8.8.8 (the Google DNS), so that you can still connect to the internet OK if the Pi Zero is powered off.

 

I'm pretty amazed by the effect this cheap little add-on has.  Every device in the house now loads web pages a great deal faster, with no adverts.  The page load speed increase is really significant on a lot of websites, and as a bonus your data usage probably drops a fair bit too, as you will no longer be downloading all the ad-related stuff.

 

  • Like 1
Link to comment
Share on other sites

18 minutes ago, ProDave said:

I just use a browser ad blocker. I have only found 1 website that refused to load until I white listed it to allow the adverts.

 

 

That's what I had been using until today, but there are problems with them, as some sites have started putting up flags saying "we've noticed you're using an ad blocker and this may affect some of the functionality of this site" and one or two sites just refuse to work unless the ad blocker is turned off, I've found.

 

Pi-Hole is massively faster, and web sites don't seem to know that you're blocking ads - one site that always puts the "we've noticed you're using an ad blocker..." no longer puts the banner up now (although I had to disable the ad blocker first).

 

The big bonus is that site loads times are massively faster.  Some of the really heavily ad-infested websites load in around 1/4 of the time that they used to take with the ad blocker installed. 

  • Like 2
Link to comment
Share on other sites

I run a PoE switch and I’m just about to buy a Pi Zero to run my Radius server using a PoE splitter, 48v to 5v buck and an Ethernet to USB adapter. 

 

Whole lot will go in a box and I’m just adding the storage to the USB Ethernet adapter using thumb drives to make a poor mans SSD...

 

May even build another to do the NVR..!

Link to comment
Share on other sites

I'm running a fair bit of stuff off direct LVDC PoE, rather than "proper"  PoE.  This works fine for things like powering Pi Zero's over Ethernet, as well as powering our 12V VDSL2 modem, 5V Switch etc.  I have a stack of batteries charged from a switched mode supply, then use a few switched mode DC-DC converters to provide LVDC at either 12V or 5V to directly run devices using PoE.  The Pi-Hole is currently running here at the old house on a 5V power supply, but it already has a hacked USB to Ethernet adapter that will allow me to just connect it so it runs from 5V PoE in the new house, from the battery supply.  The big advantage is that if we get a power cut the LAN stays up, including the internet connection and wireless router, switch, and network storage (which is another RPi3 with a 1Tb HDD).

 

The Pi-Hole really is impressive at cutting out loads of crap from websites.  The more I've used it today the more impressed I am with the way it speeds up page loads by just cutting out all the ads before they even reach the target device.  Absolutely brilliant.

Link to comment
Share on other sites

Guest Alphonsox

As an interesting addition to Pi-Hole (which operates as a local DNS resolver for your network) this site describes adding a secure DNS-over-HTTPS (DoH) connection to the cloudflare 1.1.1.1 resolver. This gives you a secure, add free open DNS setup - It looks like a compelling combination. Yet another thing on my list of things to have a closer look at.

 

https://scotthelme.co.uk/securing-dns-across-all-of-my-devices-with-pihole-dns-over-https-1-1-1-1/

 

 

Link to comment
Share on other sites

That does look interesting.  At the moment I'm running the Pi-Hole through Open DNS, so it's letting legitimate requests out to Open DNS and just blocking all requests from the LAN side to resolve any URL on the block lists it's using.  The effect is interesting on web pages with lots of ads, as you just have loads of blank spaces where the ads should be, and no annoying banners about using an ad blocker.  I can see how this speeds things up, as only legitimate URLs get passed out to Open DNS for resolution, which cuts down the traffic be a fair bit on a typical ad-infested page.

 

Be interesting to see how the advertisers come back at this - they've already started having a go at ad blockers, presumably by being able to detect that an ad blocker is running on your browser.  Hard to see how they could easily detect that the Pi-Hole was causing their ads to not show.

Link to comment
Share on other sites

One thing to add - if you're thinking of knocking up a Pi-Hole, there's no need to splash out on a full blown Raspberry Pi 3.  I've been looking at the processor load on my Pi Zero running Pi-Hole and it is running at around 1%.  The relatively slow Ethernet speed of the USB to Ethernet adapter isn't a problem, either, as the DNS requests are only a very tiny bit of the traffic, so 99%+ of the data isn't going near the Pi-Hole at all.

Link to comment
Share on other sites

Guest Alphonsox

That’s good to know, I’ve got a few “pensioned off” RPi boards that could be pressed back into action for an application like this.

Link to comment
Share on other sites

I am interested to know whether this would add anything to using a WebKit Content Blocker (as I use). 

 

WebKit content blocking is fast, uses a compiled rules-based blocking engine (which can include the prevention of loading the offending content, and much more besides). My guess is that when using a MacOS or iOS device (iPhone or iPad) and using an up-to-date WebKit blocker with Safari, using Pi-Hole would neither offer superior blocking nor be faster. 

 

I am happy to be contradicted.

 

(More details here about WebKit content blocking here: https://webkit.org/blog/3476/content-blockers-first-look/.)

Edited by Dreadnaught
Link to comment
Share on other sites

Hi - I wanted to have a go at this but need to go shopping first.  Can you give me an idiots breakdown of exactly what I would need as I hate starting a project only to find that I am missing a vital lead or something.

Cheers

 

ETA - could you also post a link to where you got a Pi zero for a fiver please as I can't find one that cheap anywhere.  Cheers

Edited by Square Feet
Link to comment
Share on other sites

I've just made one of these. You need

 

pi-zero £4.65 from pi-hut https://thepihut.com/collections/raspberry-pi-store/products/raspberry-pi-zero

 

a microSD card, I bought an 8GB one from pi-hut because it was convenient - 4GB would be more than enough.

 

a network adapter, I bought a micro usb to RJ45 adapter from ebay for £4.

 

You will also need a micro USB power supply of some sort and a means of attaching the microSD card to a computer for writing the OS to it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...