/etc/coredns.conf
.:53 {
any
# Google
forward . tls://8.8.8.8 tls://8.8.4.4 {
tls_servername dns.google
health_check 5s
}
# Cloudflare
#forward . tls://1.1.1.1 tls://1.0.0.1 {
# tls_servername cloudflare-dns.com
# health_check 5s
#}
# Just in case
#forward . 8.8.8.8:53 8.8.4.4:53 1.1.1.1:53
errors
log
}
/etc/systemd/system/coredns.service
[Unit]
Description=CoreDNS Service
DefaultDependencies=no
After=systemd-sysusers.service systemd-networkd.service
Before=network.target nss-lookup.target shutdown.target
Conflicts=shutdown.target
[Service]
Type=simple
User=root
Group=root
Restart=always
RestartSec=0
WatchdogSec=3min
ExecStart=/sbin/coredns -conf /etc/coredns.conf
[Install]
WantedBy=multi-user.target
/etc/resolv.conf
nameserver 127.0.0.1
Commands
Setup
wget https://github.com/coredns/coredns/releases/download/v1.6.6/coredns_1.6.6_linux_amd64.tgz
tar xzf coredns_1.6.6_linux_amd64.tgz
sudo mv coredns /sbin/
# ... config files ...
Run
sudo systemctl daemon-reload
sudo systemctl enable coredns
sudo systemctl restart coredns
sudo systemctl status coredns