Quản lý dịch vụ
Kiểm tra trạng thái CoreDNS:
systemctl status coredns
Khởi động lại CoreDNS:
systemctl restart coredns
Tải lại CoreDNS:
systemctl reload coredns
Dừng CoreDNS:
systemctl stop coredns
Khởi động CoreDNS:
systemctl start coredns
Xem nhật ký CoreDNS:
journalctl -u coredns -f
Cấu hình DNS
Cấu hình chính của CoreDNS là:
/etc/coredns/Corefile
Cấu hình mặc định chuyển tiếp truy vấn DNS tới:
1.1.1.1 8.8.8.8
Cấu hình Corefile theo nhu cầu cụ thể và trường hợp sử dụng của bạn.
Sau khi sửa Corefile, khởi động lại CoreDNS:
systemctl restart coredns
Điểm cuối DNS
- DNS:
53/tcpvà53/udp - Tình trạng:
http://127.0.0.1:8080/health - Sẵn sàng:
http://127.0.0.1:8181/ready - Số liệu:
http://127.0.0.1:9153/metrics
File và thư mục quan trọng
- Tệp nhị phân:
/usr/bin/coredns - Corefile:
/etc/coredns/Corefile - Dịch vụ:
/etc/systemd/system/coredns.service - Sysusers:
/usr/lib/sysusers.d/coredns.conf - Tmpfiles:
/usr/lib/tmpfiles.d/coredns.conf - Logrotate:
/etc/logrotate.d/coredns - Thư mục dữ liệu:
/var/lib/coredns - Tệp log:
/var/log/coredns.log - Log lỗi:
/var/log/coredns.err.log - Ghi đè resolver:
/etc/systemd/resolved.conf.d/99-coredns.conf
Kiểm tra phân giải DNS
Truy vấn trực tiếp CoreDNS:
dig @127.0.0.1 example.com
Hoặc truy vấn bằng IP của máy chủ:
dig @<SERVER-IP> example.com
The host's /etc/resolv.conf is configured to use:
nameserver 127.0.0.1
Ghi chú
- CoreDNS uses
systemd-resolvedcác thay đổi cấu hình để giải phóng cổng 53. - The host resolver is pointed to
127.0.0.1. - Các truy vấn DNS được chuyển tiếp tới các resolver upstream đã cấu hình.
- CoreDNS runs under the dedicated
corednssystem user.