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/tcpand53/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-resolvedconfiguration 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
corednssystem user.