I get CoreDNS binary file.
[root@cent7devops ~]# wget https://github.com/coredns/coredns/releases/download/v1.2.0/coredns_1.2.0_linux_amd64.tgz *snip* [root@cent7devops ~]# ls coredns_1.2.0_linux_amd64.tgz coredns_1.2.0_linux_amd64.tgz [root@cent7devops ~]# [root@cent7devops ~]# tar xfz coredns_1.2.0_linux_amd64.tgz [root@cent7devops ~]# ls -1 coredns* coredns coredns_1.2.0_linux_amd64.tgz [root@cent7devops ~]#
I check version.
[root@cent7devops ~]# coredns --version CoreDNS-1.2.0 linux/amd64, go1.10.3, 2e322f6 [root@cent7devops ~]#
Next, I prepare Corefile. Corefile is configuration file of CoreDNS.
[root@cent7devops ~]# vi Corefile [root@cent7devops ~]# cat Corefile . { whoami errors log } [root@cent7devops ~]#
I run CoreDNS. Default port for CoreDNS is "53".
[root@cent7devops ~]# coredns -conf Corefile .:53 2018/07/13 01:49:41 [INFO] CoreDNS-1.2.0 2018/07/13 01:49:41 [INFO] linux/amd64, go1.10.3, 2e322f6 CoreDNS-1.2.0 linux/amd64, go1.10.3, 2e322f6
[root@cent7devops ~]# ss -antp | grep 53 LISTEN 0 128 :::53 :::* users:(("coredns",pid=5596,fd=3)) [root@cent7devops ~]#
I set firewall configuration to DNS.
[root@cent7devops ~]# firewall-cmd --list-services dhcpv6-client ssh [root@cent7devops ~]# firewall-cmd --add-service dns success [root@cent7devops ~]# firewall-cmd --add-service dns --permanent success [root@cent7devops ~]# firewall-cmd --list-services dhcpv6-client ssh dns [root@cent7devops ~]#
I got response to dig commnad.
[root@cent7devops ~]# dig -p 53 @localhost AAA . ; <<>> DiG 9.9.4-RedHat-9.9.4-61.el7 <<>> -p 53 @localhost AAA . ; (2 servers found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25187 ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1 *snip* [root@cent7devops ~]#
When I execute dig command, CoreDNS output the following log in STDOUT.
[::1]:37018 - [13/Jul/2018:01:50:05 +0900] 58016 "A IN aaa. udp 33 false 4096" NOERROR qr,aa,rd 92 0.00010228s [::1]:43725 - [13/Jul/2018:01:50:05 +0900] 13554 "A IN . udp 30 false 4096" NOERROR qr,aa,rd 82 0.000038707s