Low-cost ESP32-C3 DNS blocker enables ad-filtering without PSRAM
A new firmware implementation uses 40-bit FNV-1a hashes stored in flash to allow 140,000+ domain blocklists on memory-constrained microcontrollers.
Summary
A new open-source DNS blocking project by Zed (M-Abozaid) allows for network-wide ad and tracker filtering using a low-cost ESP32-C3 Super Mini module. The system functions by intercepting DNS queries and returning 0.0.0.0 for domains present on a blocklist, while forwarding legitimate requests to external servers.
To accommodate the limited resources of the ESP32-C3, the firmware avoids the need for external Pseudo Static RAM (PSRAM). Instead, it utilizes a highly efficient storage method for domain names, making it possible to run a robust privacy tool on hardware costing approximately $2.
Technical implementation of hash-based filtering
- Memory Optimization: Domains are stored in flash memory as sorted 40-bit FNV-1a hashes, requiring only 0.7 MB of flash and 50 KB of RAM to manage over 140,000 entries.
- Lookup Performance: The C++ firmware performs a binary search of the flash-resident table; a full lookup takes approximately 10 ms, while the specific blocklist check occurs in roughly 50 microseconds.
- Network Management: The device features a web-based dashboard for monitoring client requests, managing custom domain blocks, and configuring device-specific restrictions.
- Deployment and Updates: WiFi configuration is handled via a captive portal, and the system supports Over-the-Air (OTA) updates for both the firmware and the blocklist itself.
Why it matters
This project demonstrates how efficient data structures can extend the utility of inexpensive RISC-V and Xtensa-based microcontrollers in privacy-focused networking. It provides a blueprint for developers building low-power, minimal-footprint edge devices for home or small office security.
Original reference: blog.adafruit.com →