How I block ads with a $7 Raspberry Pi alternative - it's easy

1 day ago 26
A $7 ESP32-S3 is simply a almighty  and versatile system
Adrian Kingsley-Hughes/ZDNET

Follow ZDNET: Add america arsenic a preferred source on Google.


ZDNET's cardinal takeaways

  • A inexpensive $7 committee tin crook its manus to advertisement blocking.
  • It works arsenic a DNS sinkhole, stripping retired ads earlier download.
  • Other options see utilizing a Raspberry Pi and buying hardware.

They accidental that necessity is the parent of invention, and the skyrocketing prices of Raspberry Pi boards person decidedly been the footwear successful the pants that I've needed to look astatine cheaper, possibly besides better-suited, alternatives. I mean, the Pi is simply a large board, but for a batch of applications I've utilized it for implicit the astir 15 years that they've been around, it's besides been overkill.

The different day, I needed to enactment unneurotic an ad-block solution, not due to the fact that I dislike ads, but simply due to the fact that I was moving with rather a constricted bandwidth. I reflexively reached for a Raspberry Pi board, but stopped erstwhile I remembered however overmuch they outgo nowadays and enactment it back.

Also: I tested a Bluetooth tracker that leverages LoRa mesh networks to find things - and it's truthful accurate

I was going to usage PiHole connected the Pi, but past I remembered coming crossed an ad-block project that worked connected an ESP32 board. And the bully quality is that you tin prime up 1 of those boards for nether $10.

ESP32-S3 (left) vs ESP32 (right)

ESP32-S3 (left) vs ESP32 (right).

Adrian Kingsley-Hughes/ZDNET

Introducing the ESP32-S3

There's a immense quality betwixt a Raspberry Pi 5 and an ESP32 committee (specifically the ESP32-S3 board). The Pi 5 is powered by a 2.4 GHz quad-core Arm Cortex-A76 64-bit chip, gigabytes of RAM, and the quality to usage microSD oregon accelerated NVMe SSD storage, portion the ESP32 makes usage of a dual-core Tensilica Xtensa LX7 32-bit processor that tin tally astatine up to 240 MHz, 520 KB of RAM, and up to 16MB of flash storage. A Pi 5 tin usage arsenic overmuch arsenic 12 W of powerfulness (and that's earlier you hook up assorted HATs and such), portion an ESP32 committee uses milliwatts. 

For this project, I'm blessed to spell with the ESP32, but determination are a fewer compromises that I'll person to unrecorded with -- much connected those later.

What you need

First, you request an ESP32 board. Look for the ESP32-S3 with 8MB of PSRAM (there's a 4MB mentation too, but utilizing this committee volition effect successful compromises) alternatively than the classical ESP32. The ESP32-S3 is faster and much efficient, and you request this powerfulness to tally the ad-block software. The cheapest mode to bargain these boards is successful a 3-pack for $20

Also: I built my ain Wi-Fi router with a Raspberry Pi for Starlink and star power - here's how

When you get an ESP32-S3 committee for the archetypal time, it's mean to think, "Wow, this is tiny, determination indispensable beryllium much to it," but determination isn't. It truly is simply a machine you tin equilibrium connected a finger. 

Well, you volition request a USB-C cablegram to transportation information and powerfulness the board. However, you don't adjacent request a microSD paper for the committee to work.

Also: I installed a $17 star sheet onto my doorbell camera, and it's easy my champion astute location investment

Talking of the software, you'll besides request to download ESP32_AdBlocker, which does each the hard work. You'll besides request the Arduino IDE inferior to instal the bundle onto the board. Installing the bundle is casual -- configure the Arduino IDE exertion to enactment with the ESP32 board, unfastened the merchandise successful the application, link the committee to your PC, and click upload. 

No coding needed -- you're conscionable  loading existing codification  onto the ESP32-S3.

No coding needed. Just load existing codification onto the ESP32-S3.

Adrian Kingsley-Hughes/ZDNET

Note that erstwhile you link the ESP32-S3 committee to your computer, it has 2 USB ports. You privation the 1 marked arsenic COM oregon USB/Native (looking down astatine the committee with the ports astatine the bottom, this is the larboard connected the right). Alternatively, effort a antithetic port.

Also: I setup a $4 router reboot timer, and it's made my net reliably faster

If you get into trouble, there's no end of help available. One of the biggest issues I find radical tally into is trying to link the ESP32 to their machine utilizing a charge-only USB-C cable. I besides had to fiddle with the compile and committee settings successful the Arduino IDE software. I've added a screenshot beneath of the settings I utilized to get things working.  

ESP32-S3 (left) vs ESP32 (right)

My Arduino IDE settings.

Screenshot by Adrian Kingsley-Hughes/ZDNET

And finally, if you request a lawsuit for the ESP32-S3 board, you person options. You can buy one3D people one, oregon bash a MacGyver and wrapper it successful a spot of electrical tape or large-diameter shrink-wrap tubing (about 1.5 inches across). 

Setting up the board

OK, truthful you've loaded the bundle onto the ESP32. Now it's clip for a archetypal footwear and to get the committee acceptable up. Your ESP32 committee is present a web appliance.

On archetypal boot, the ESP32 starts successful Wi-Fi entree constituent mode with an code that starts: ESP32_Adblocker_XXXXXXXXXXXX (where each X is an alphanumeric character). 

It lives.

Our committee lives.

Screenshot by Adrian Kingsley-Hughes/ZDNET

Once you've connected to the Wi-Fi, spell to 192.168.4.1 and adhd the Wi-Fi SSID and password for your router. After different reboot, it's clip to specify the URL of the blocklist you privation to usage (you tin find a monolithic repository of blocklists here), and past you're beauteous overmuch done with the board.

We're in! ESP32_Adblocker successfully installed

We're in. ESP32_Adblocker successfully installed.

Screenshot by Adrian Kingsley-Hughes/ZDNET

The lone different happening to bash is configure your devices to nonstop DNS requests (more connected this successful a moment) to the ESP32 board. To bash this, you request to instrumentality that earlier code -- 192.168.4.1 -- and usage it arsenic the DNS address. A bully mode to find retired however to bash this task is to cheque out CloudFlare's fantabulous documentation for the platforms (remember to acceptable the DNS to your ESP32's address, not CloudFlare's 1.1.1.1 address).

But however does it work? 

When you benignant a URL oregon click a link, your browser needs to cognize wherever connected the net that web leafage lives. To find this information, your browser consults an online directory called a DNS server via DNS lookup (DNS stands for Domain Naming System). 

Think of DNS arsenic a telephone directory, but for server addresses. The web page, and each the components of that web leafage -- the images, immoderate videos oregon sounds oregon animated under-construction GIFs, and, of course, the ads -- tin each beryllium astatine the aforesaid determination oregon travel from antithetic servers scattered each astir the world. The browser looks up the addresses of wherever each these parts of the webpage are stored to physique the leafage that it shows you. 

Now, here's the clever bit. Because you present told your smartphone, PC, oregon router to inquire the ESP32 committee for DNS accusation (which is wherefore you had to alteration the router's DNS mounting for this attack to work), each DNS lookup that happens is filtered by that tiny ESP32 committee first. 

Also: My 7 indispensable laptop-bag items aft decades of moving remotely

The ESP32_AdBlocker bundle holds a blocklist of millions of addresses for net ads, and, enactment simply, each clip the browser requests thing that's successful the blocklist, the bundle tells the browser that it can't beryllium recovered by pointing it to the 0.0.0.0 DNS address, and the blocked advertisement ne'er loads, redeeming you a spot of net bandwidth. If the code is not connected that list, the committee passes that DNS lookup to a due DNS server. 

What you've built is simply a DNS sinkhole for the bulk of the ads that you spot connected the internet.

There are limitations. For example, the strategy doesn't enactment with YouTube ads due to the fact that they're served from the aforesaid server and astatine the aforesaid code arsenic the videos you privation to watch, truthful blocking these ads would artifact the videos. The attack besides doesn't enactment with newer IPv6 net addresses. 

Also: I tested a $15 astute power and recovered a java shaper wasting $1,500 a twelvemonth successful electricity

But this task inactive shows what's achievable with a tiny committee costing nether $10.

The ESP32-S3 successful  enactment   filtering ads.

The ESP32-S3 successful action, filtering ads.

Adrian Kingsley-Hughes/ZDNET

Not the lone option

For the exertion I needed -- a impermanent solution to enactment with a limited-bandwidth net transportation -- this attack works. And it was 1 of those absorbing projects to play with. If I wanted a semipermanent solution, oregon I didn't privation to enactment a velocity bump connected a accelerated net pipe, a Raspberry Pi Zero 2 W moving PiHole is simply a bully solution. But that attack already pushes the outgo up to astatine slightest $15 for the bare board, positive a microSD card. Nothing that's going to request a 2nd mortgage, but it's a antithetic level for sure. 

You could tally PiHome connected a wholly abstracted computer, oregon successful a virtual instrumentality connected a computer. Or buy an appliance that supports advertisement blocking retired of the box. But what's the amusive successful that? Different horses for antithetic courses. 

Read Entire Article