Skip to main content
50% off all plans, limited time. Starting at $2.48/mo
CoreDNS

CoreDNS

CoreDNS is a DNS server that chains plugins. Serve zones from files, etcd, or Kubernetes, forward with caching, and add DNS-over-TLS or Prometheus metrics by adding a line to the Corefile. Apache-2.0 licensed with 14,200+ GitHub stars.

At a glance

License Apache-2.0 Version Latest OS Ubuntu Server 24.04 LTS Min RAM 1 GB IP IPV4,IPV6

Service Management

Check CoreDNS status:

systemctl status coredns

Restart CoreDNS:

systemctl restart coredns

Reload CoreDNS:

systemctl reload coredns

Stop CoreDNS:

systemctl stop coredns

Start CoreDNS:

systemctl start coredns

View CoreDNS logs:

journalctl -u coredns -f

DNS Configuration

The primary CoreDNS configuration is:

/etc/coredns/Corefile

The default configuration forwards DNS queries to:

1.1.1.1 8.8.8.8

Configure the Corefile according to your specific needs and use case.

After changing the Corefile, restart CoreDNS:

systemctl restart coredns

DNS Endpoints

  • DNS: 53/tcp and 53/udp
  • Health: http://127.0.0.1:8080/health
  • Ready: http://127.0.0.1:8181/ready
  • Metrics: http://127.0.0.1:9153/metrics

Important Files & Directories

  • Binary: /usr/bin/coredns
  • Corefile: /etc/coredns/Corefile
  • Service: /etc/systemd/system/coredns.service
  • Sysusers: /usr/lib/sysusers.d/coredns.conf
  • Tmpfiles: /usr/lib/tmpfiles.d/coredns.conf
  • Logrotate: /etc/logrotate.d/coredns
  • Data Directory: /var/lib/coredns
  • Log File: /var/log/coredns.log
  • Error Log: /var/log/coredns.err.log
  • Resolver Override: /etc/systemd/resolved.conf.d/99-coredns.conf

Test DNS Resolution

Query CoreDNS directly:

dig @127.0.0.1 example.com

Or query it using the server's IP:

dig @<SERVER-IP> example.com

The host's /etc/resolv.conf is configured to use:

nameserver 127.0.0.1

Notes

  • CoreDNS uses systemd-resolved configuration changes to free port 53.
  • The host resolver is pointed to 127.0.0.1.
  • DNS queries are forwarded to the configured upstream resolvers.
  • CoreDNS runs under the dedicated coredns system user.

Deploy CoreDNS now. From $2.48/mo.