Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Erlang DNS Server

Serve DNS authoritative responses... with Erlang.



To build:


To start fresh:

make fresh


Zones are loaded from JSON. Example JSON files are in the priv/ directory.

You can also write new systems to load zones by writing the zones directly to the zone cache using erldns_zone_cache:put_zone/1.


An example configuration file can be found in erldns.example.config. Copy it to erldns.config and modify as needed.


Launch directly:

overmind start

To get an interactive Erlang REPL:

./rebar3 shell

Build a distribution with and run the release:

./rebar3 release
./_build/default/rel/erldns/bin/erldns foreground


Here are some queries to try:

dig -p 8053 @ a
dig -p 8053 @ cname
dig -p 8053 @ ns
dig -p 8053 @ mx
dig -p 8053 @ spf
dig -p 8053 @ txt
dig -p 8053 @ sshfp
dig -p 8053 @ soa
dig -p 8053 @ naptr

dig -p 8053 @ -x ptr


In our environment (DNSimple) we are seeing 30 to 65 µs handoff times to retrieve a packet from the UDP port and give it to a worker for processing. Your performance may vary, but given those measurements erl-dns is capable of handling between 15k and 30k questions per second. Please note: You may need to configure the number of workers available to handle traffic at higher volumes.


The erldns_resolver module will attempt to find zone data in the zone cache. If you're embedding erl-dns in your application the easiest thing to do is to load the zone cache once the zone cache gen_server starts push an updated zone into the cache each time data changes.

To insert a zone, use erldns_zone_cache:put_zone({Name, Records}) where Name is a binary term such as <<"">> and Records is a list of dns_rr records (whose definitions can be found in deps/dns/include/dns_records.hrl). The name of each record must be the fully qualified domain name (including the zone part).

Here's an example:

  <<"">>, [
      name = <<"">>,
      type = ?DNS_TYPE_A,
      ttl = 3600,
      data = #dns_rrdata_a{ip = {1,2,3,4}}
      name = <<"">>,
      type = ?DNS_TYPE_CNAME,
      ttl = 3600,
      data = #dns_rrdata_cname{dname = <<"">>}


Folsom is used to gather runtime metrics and statistics.

There is an HTTP API for querying metric data available at


This project uses OpenTelemetry (OTEL) Tracing to provide telemetry data on request processing inside of erldns.

To enable opentelmetry tracing, you need to:

  1. Add opentelemetry as dependency of your application.

  2. Configure the opentelemetry client:

    Add the following configuration to the erldns.config:

                #{exporter => {opentelemetry_exporter, #{protocol => http_protobuf,
                                                        endpoints => [{http, "", 55681, []}]}}}}]}

NOTE: You will need to have a running OpenTelemetry Collector.

Application traces:

Name Dimensions
handle_tcp_dns_query status, qr, rd, ad, qname, qtype
handle_decoded_tcp_message status
erldns_udp_worker host, port, erlang_port_count, erlang_proc_count, erlang_run_queue, erlang_proc_message_queue_len, status
handle_udp_dns_query status, qr, rd, ad, qname, qtype
handle_decoded_udp_message status
encode_message rcode, aa, ra, answers


There is an administrative API for querying the current zone cache and for basic control. You can find it in