Tiny $5 dongle blocks 537,000 domains in 10 milliseconds
In an era where high-end hardware often comes with a hefty price tag, some of the most brilliant solutions are found not in massive processors, but in clever code and repurposed microcontrollers. Forget expensive RAMageddon; true innovation often lies in salvaging what others discard. Recently, a developer has demonstrated just how potent this principle can be, creating a fully functional, hardware-based ad-blocking DNS filter using incredibly cheap components.
The core idea is simple: why buy an expensive system when you can use a $5 microcontroller? An Egyptian full-stack developer named ZedAxis has achieved exactly this. He utilized an ESP32-C3 “SuperMini” board to create a device capable of blocking over 500,000 domains with astonishingly low latency—less than 10 milliseconds.
This project demonstrates the immense potential of embedded systems. The ESP32 family of microcontrollers is a well-known quantity, and this specific implementation leverages the chip’s capabilities brilliantly. While the ESP32-C3 has limited memory (just 400KB of RAM), ZedAxis didn’t try to store long lists of domain names directly. Instead, he employed a clever trick: hashing the blocklist data into 40-bit FNV-1a values.
This approach is pure algorithmic genius. By hashing and sorting the domains, the device performs a binary search against the hash table whenever a DNS query arrives. If a match is found, the request is instantly blocked. This method keeps the operational memory usage minimal, consuming only around 50KB of RAM while delivering lightning-fast results.
The ingenuity deepens when considering the hardware constraints. The ESP32 naturally reserves enough flash memory for two copies of firmware, which usually allows for over-the-air updates. ZedAxis cleverly reallocated that second partition to store the blocklist database instead. This move frees up space and dramatically increases capacity; by ditching wireless update capabilities, he managed to store approximately 537,000 domains on the device.
The resulting device isn’t intended to replace powerful solutions like Pi-hole or AdGuard Home. Instead, it functions as a quiet, resilient insurance policy. It sits unnoticed on the network, drawing minimal power and ensuring that if a primary DNS server goes down during a reboot or power outage, clients still receive filtered responses.
Perhaps the most satisfying detail of this project is the seamless integration. ZedAxis powers the entire system from the USB port on his ISP-provided fiber gateway. This connection isn’t merely for data; it’s a simple source of power, allowing the small microcontroller to operate as an almost invisible component behind the router.
It’s a testament to the spirit of open-source hacking—proving that groundbreaking network security and performance don’t require flagship hardware. It reminds us that sometimes, the most powerful technologies are those we can build ourselves, piece by ingenious piece.