Fast and lightweight DNS proxy as ad-blocker for local network with many features
open sourceApache-2.0self-hostablefree
Blocky is an open source DNS proxy and ad blocker for a local network, written in Go and shipped as a single stateless binary or Docker image configured with YAML. It blocks ad and malware domains from external lists, with allow and deny lists and upstream resolvers per client group, deep CNAME and response IP inspection and regex rules, and it caches and prefetches answers. It speaks DNS over UDP, TCP, HTTPS, TLS and QUIC, validates DNSSEC, and does custom DNS, conditional forwarding and DNS64. It has no web interface of its own: you manage it with a REST API and a CLI, watch it through Prometheus metrics and ready-made Grafana dashboards, log queries to CSV files or a database, and keep several instances in sync through Redis. Apache-2.0, with no telemetry.
Ways to install
On your own server
Package managers
Problems it solves
- block ads and trackers for every device on my home network with a lightweight DNS server configured in YAML
- give the kids' devices a stricter DNS block list than everyone else's
- send DNS from my smart home devices to a different upstream resolver than my laptops
- run an ad-blocking DNS server as a single binary on my OpenWrt router or Raspberry Pi
- run two ad-blocking DNS servers and keep their cache and blocking state in sync
- spread my network's DNS queries across several encrypted DNS-over-HTTPS providers for privacy
- block tracker domains even when they hide behind a CNAME
- resolve my internal hostnames and forward my local domain to my router's DNS
- turn ad blocking off for five minutes from a script or home automation with an HTTP call
- graph DNS queries and blocked domains per client in Grafana
- log every DNS query per client to PostgreSQL or MySQL for later analysis
- serve DNS-over-HTTPS from my own network-wide ad blocker to my devices
- a DNS ad blocker that collects no telemetry or usage data
- rate limit DNS queries per client and protect my network from DNS rebinding
Features
- blocking with external ad and malware lists, allowlists and periodic list reloads
- allow and deny lists and upstream resolvers per client group
- regex and wildcard rules
- blocks by query domain, response CNAME (deep CNAME inspection) and response IP address
- custom DNS mappings, zone files, hosts file and conditional forwarding
- caching and prefetching of frequent queries; several upstream resolvers used at once
- DNS over UDP, TCP, HTTPS, TLS, QUIC (RFC 9250) and HTTPS/3; serves a DoH endpoint
- DNSSEC validation, EDNS client subnet and DNS64
- DNS rebinding protection and rate limiting per client IP
- Prometheus metrics and prepared Grafana dashboards
View 6 more
- query logging per day and client to CSV, MySQL/MariaDB, PostgreSQL, TimescaleDB or SQLite, or dnstap
- REST API with an OpenAPI spec, and a CLI
- cache and blocking state synced between instances through Redis
- single or multiple YAML config files; stateless, single binary
- binaries for Linux, macOS, Windows, FreeBSD, NetBSD and OpenBSD on x86-64, ARM and MIPS; multi-arch Docker image
- no telemetry or data collection
Limitations
- Doesn't have a built-in web interface: web UIs for it are third-party projects4
Capabilities
| Has an API | plan not known |
|---|---|
| Has a command line tool | plan not known |
Alternatives
The same job
These do what Blocky does.
- AdGuard Home Network-wide ads & trackers blocking DNS server
- Pi-hole Network-wide ad blocking
- Maza ad blocking Simple, native and efficient local ad blocker. Only Bash.
- Technitium DNS Server Self host a DNS server for privacy & security
- Numa Portable DNS resolver: ad blocking, local .numa names and private upstream queries
