Back to services

blocky

Fast and lightweight DNS proxy as ad-blocker for local network with many features (alternative to Pi-hole).

View alternatives to blocky
Suggest edit
Open source
Self-hostable
Apache-2.0
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Introduction

Blocky is a DNS proxy and ad blocker for local networks, written in Go. Client devices send their DNS queries to Blocky. Allowed queries are forwarded to upstream resolvers, while domains that match a blocking rule get a blocking response straight away. It is more than an ad blocker: it is also a lightweight DNS service that you can configure in fine detail.

Key Features

Blocking

  • Blocks DNS queries using external lists (ads, malware, etc.), with support for allowlists
  • Lets you set different allowlists and denylists for different client groups, such as "kids' devices" or "smart home devices"
  • Automatically reloads external lists on a regular schedule
  • Supports regular expressions
  • Blocking covers the requested domain, CNAMEs in the response (deep CNAME inspection), and response IP addresses (checked against IP lists)

Advanced DNS Configuration

  • Custom resolution for specific domains
  • Conditional forwarding of queries to designated external DNS servers
  • Upstream resolvers can be assigned per client group

Performance

  • Customizable DNS response cache that speeds up resolution and reduces outgoing queries
  • Prefetching and caching of frequently used queries
  • Uses several external resolvers at the same time
  • Low memory footprint

Protocol Support

  • DNS over UDP / TCP
  • DNS over HTTPS (DoH)
  • DNS over TLS (DoT)
  • DNS over QUIC (DoQ, RFC 9250)
  • DNS over HTTPS/3 (DoH3)

Security and Privacy

  • Supports modern DNS extensions such as DNSSEC and eDNS, and can perform DNSSEC validation on upstreams
  • Blocklists are entirely user-configured, with no hidden filtering
  • Can serve a DoH endpoint itself
  • Randomly picks among the configured upstream resolvers, spreading DNS traffic across several providers to improve privacy
  • Does not collect any user data, telemetry or statistics

Integrations

  • Provides Prometheus metrics, with a ready-made Grafana dashboard
  • Logs DNS queries per day or per client, to CSV files or to MySQL/MariaDB/PostgreSQL/Timescale databases
  • Offers a REST API and a CLI tool

Who It's For

Blocky suits home network users, self-hosting enthusiasts, HomeLab fans and small-network administrators who want to block ads and trackers centrally at the network level and manage DNS policies by device group. If you want something lighter than Pi-hole or AdGuard Home and driven entirely by configuration files, it is worth considering.

Core Strengths

  • Stateless: needs no database and creates no temporary files, which makes it easy to maintain and back up
  • Simple configuration: everything is configured with one or more YAML files
  • Lightweight deployment: a single binary, plus multi-architecture Docker images
  • Low hardware requirements: supports x86-64, ARM and MIPS, and runs smoothly on Raspberry Pi and OpenWrt routers

Installation and Deployment

  1. Prepare a config.yml configuration file that defines the upstream resolvers, blocklists and listening ports. Example:
upstreams:
  groups:
    default:
      - 46.182.19.48
      - tcp-tls:fdns1.dismail.de:853
      - https://dns.digitale-gesellschaft.ch/dns-query
blocking:
  denylists:
    ads:
      - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
  clientGroupsBlock:
    default:
      - ads
ports:
  dns: 53
  http: 4000
  1. Ways to run it:
    • Binary: download the file for your architecture from GitHub Releases and run ./blocky --config config.yml
    • Docker: use the Docker Hub image spx01/blocky; docker-compose is also supported
    • Other options: Arch Linux (AUR), Alpine Linux, install scripts for CentOS/Debian/Fedora, FreeBSD, Gentoo, NixOS, macOS (Homebrew), TrueNAS SCALE (TrueCharts), and a community-maintained Kubernetes Helm chart

Technical Requirements and Notes

  • On Linux, binding to privileged ports such as 53 as a non-root user requires granting the binary the NET_BIND_SERVICE capability (for example setcap 'cap_net_bind_service=+ep' ./blocky), or using a port above 1024
  • The container runs by default as an unprivileged user with UID 100. If you use bind mounts for the query log and cache directories, make sure this user has write permission
  • The http port serves the REST API and Prometheus metrics
  • Blocky has no built-in web admin interface. You can use companion projects such as community-built web UIs and list update tools
  • The project is free and open source, hosted on GitHub and Codeberg