Last active
March 19, 2021 15:06
-
-
Save gbrayut/3007c66ef9f6e02c7ab99cb875c106d2 to your computer and use it in GitHub Desktop.
Coredns using Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
home.arpa { | |
file config/home.arpa | |
prometheus # enable metrics | |
errors # show errors | |
log # enable query logs | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Start coredns instance using docker. Bind to DNS ports, map /opt/coredns to /config in container and use it's Corefile | |
docker run --name coredns --restart=always -d -p 53:53 -p 53:53/udp -v /opt/coredns:/config coredns/coredns -conf /config/Corefile | |
#View log files of container (use logs -f to follow logs) | |
docker logs coredns | |
#Testing (non-persistant container that will be deleted when stopped). Use docker ps to see it's container name | |
docker run --rm coredns/coredns --help #See command line options (there is no sh or bin in this container) | |
docker kill --signal="SIGUSR1" coredns #send signal to reload if config is changed (need to use auto plugin to auto reload) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ORIGIN home.arpa. | |
@ 3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. ( | |
2017042745 ; serial | |
7200 ; refresh (2 hours) | |
3600 ; retry (1 hour) | |
1209600 ; expire (2 weeks) | |
3600 ; minimum (1 hour) | |
) | |
testrecord IN A 127.0.0.1 | |
internal.home.arpa. IN DNAME example.com. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ dig +additional www.internal.home.arpa | |
; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.internal.home.arpa | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10972 | |
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1 | |
;; OPT PSEUDOSECTION: | |
; EDNS: version: 0, flags:; udp: 4096 | |
;; QUESTION SECTION: | |
;www.internal.home.arpa. IN A | |
;; ANSWER SECTION: | |
internal.home.arpa. 3600 IN DNAME example.com. | |
www.internal.home.arpa. 3600 IN CNAME www.example.com. | |
www.example.com. 0 IN A 93.184.216.34 | |
;; Query time: 6 msec | |
;; SERVER: 127.0.1.1#53(127.0.1.1) | |
;; WHEN: Sun Aug 19 21:38:24 MDT 2018 | |
;; MSG SIZE rcvd: 150 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment