Správa služeb
Zkontrolujte stav CoreDNS:
systemctl status coredns
Restartujte CoreDNS:
systemctl restart coredns
Znovu načtěte CoreDNS:
systemctl reload coredns
Zastavte CoreDNS:
systemctl stop coredns
Spusťte CoreDNS:
systemctl start coredns
Zobrazit logy CoreDNS:
journalctl -u coredns -f
Konfigurace DNS
Hlavní konfigurace CoreDNS je:
/etc/coredns/Corefile
Výchozí konfigurace přeposílá DNS dotazy na:
1.1.1.1 8.8.8.8
Nastavte Corefile podle svých konkrétních potřeb a use case.
Po změně Corefile restartujte CoreDNS:
systemctl restart coredns
DNS endpointy
- DNS:
53/tcpa53/udp - Health:
http://127.0.0.1:8080/health - Ready:
http://127.0.0.1:8181/ready - Metriky:
http://127.0.0.1:9153/metrics
Důležité soubory a adresáře
- Binárka:
/usr/bin/coredns - Corefile:
/etc/coredns/Corefile - Služba:
/etc/systemd/system/coredns.service - Sysusers:
/usr/lib/sysusers.d/coredns.conf - Tmpfiles:
/usr/lib/tmpfiles.d/coredns.conf - Logrotate:
/etc/logrotate.d/coredns - Datový adresář:
/var/lib/coredns - Soubor logu:
/var/log/coredns.log - Log chyb:
/var/log/coredns.err.log - Přepsání resolveru:
/etc/systemd/resolved.conf.d/99-coredns.conf
Test překladu DNS
Dotažte se CoreDNS přímo:
dig @127.0.0.1 example.com
Nebo se ho dotažte pomocí IP adresy serveru:
dig @<SERVER-IP> example.com
The host's /etc/resolv.conf is configured to use:
nameserver 127.0.0.1
Poznámky
- CoreDNS uses
systemd-resolvedzměny konfigurace, aby se uvolnil port 53. - The host resolver is pointed to
127.0.0.1. - DNS dotazy se přeposílají na nakonfigurované upstream resolvery.
- CoreDNS runs under the dedicated
corednssystem user.