Difference between revisions of "CoreDNS"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | # | ||
+ | - https://www.oreilly.com/library/view/learning-coredns/9781492047957/ch01.html | ||
+ | |||
+ | # Compile with unbound | ||
+ | - https://coredns.io/manual/toc/ | ||
+ | ``` | ||
+ | Add unbound:github.com/coredns/unbound to plugin.cfg. | ||
+ | Do a go generate, followed by make. | ||
+ | ``` | ||
+ | |||
- https://coredns.io/plugins/acl/ | - https://coredns.io/plugins/acl/ | ||
- https://github.com/coredns/example/blob/master/example.go | - https://github.com/coredns/example/blob/master/example.go | ||
Line 9: | Line 19: | ||
- https://github.com/coredns/rrl | - https://github.com/coredns/rrl | ||
- https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb | - https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb | ||
+ | - https://wiki.archlinux.org/index.php/CoreDNS | ||
− | Golang | + | |
+ | # Golang | ||
- https://medium.com/@openmohan/dns-basics-and-building-simple-dns-server-in-go-6cb8e1cfe461 | - https://medium.com/@openmohan/dns-basics-and-building-simple-dns-server-in-go-6cb8e1cfe461 | ||
- https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb | - https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb | ||
+ | - https://github.com/openmohan/lightdns | ||
+ | |||
+ | # Example coredns.conf | ||
+ | ``` | ||
+ | coredns.io:5300 { | ||
+ | file /etc/coredns/zones/coredns.io.db | ||
+ | } | ||
+ | |||
+ | example.io:53 { | ||
+ | errors | ||
+ | log | ||
+ | file /etc/coredns/zones/example.io.db | ||
+ | } | ||
+ | |||
+ | example.net:53 { | ||
+ | file /etc/coredns/zones/example.net.db | ||
+ | } | ||
+ | |||
+ | .:53 { | ||
+ | hosts { | ||
+ | 10.0.0.1 example.org | ||
+ | fallthrough | ||
+ | } | ||
+ | # unbound | ||
+ | errors | ||
+ | log | ||
+ | health | ||
+ | # rewrite name foo.example.com foo.default.svc.cluster.local | ||
+ | rewrite name foo.google.com www.google.com | ||
+ | # kubernetes cluster.local 10.0.0.0/24 | ||
+ | file /etc/coredns/example.db example.org | ||
+ | forward . /etc/resolv.conf | ||
+ | cache 30 | ||
+ | } | ||
+ | ``` | ||
+ | db.example.com | ||
+ | ``` | ||
+ | $ORIGIN example.org. | ||
+ | @ 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) | ||
+ | ) | ||
+ | |||
+ | 3600 IN NS a.iana-servers.net. | ||
+ | 3600 IN NS b.iana-servers.net. | ||
+ | 3600 IN NS busk.iana-servers.net. | ||
+ | |||
+ | www IN A 127.0.0.1 | ||
+ | IN AAAA ::1 | ||
+ | ``` |
Latest revision as of 01:20, 20 October 2020
- https://www.oreilly.com/library/view/learning-coredns/9781492047957/ch01.html
Compile with unbound
Add unbound:github.com/coredns/unbound to plugin.cfg. Do a go generate, followed by make.
- https://coredns.io/plugins/acl/
- https://github.com/coredns/example/blob/master/example.go
- https://github.com/miekg/local/blob/master/local.go
- https://coredns.io/2017/03/01/how-to-add-plugins-to-coredns/
- https://coredns.io/plugins/
- https://coredns.io/manual/toc/
- https://coredns.io/plugins/proxy/
- https://github.com/coredns/coredns/issues/2277
- https://github.com/coredns/rrl
- https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb
- https://wiki.archlinux.org/index.php/CoreDNS
Golang
- https://medium.com/@openmohan/dns-basics-and-building-simple-dns-server-in-go-6cb8e1cfe461
- https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb
- https://github.com/openmohan/lightdns
Example coredns.conf
coredns.io:5300 { file /etc/coredns/zones/coredns.io.db } example.io:53 { errors log file /etc/coredns/zones/example.io.db } example.net:53 { file /etc/coredns/zones/example.net.db } .:53 { hosts { 10.0.0.1 example.org fallthrough } # unbound errors log health # rewrite name foo.example.com foo.default.svc.cluster.local rewrite name foo.google.com www.google.com # kubernetes cluster.local 10.0.0.0/24 file /etc/coredns/example.db example.org forward . /etc/resolv.conf cache 30 }
db.example.com
$ORIGIN example.org. @ 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) ) 3600 IN NS a.iana-servers.net. 3600 IN NS b.iana-servers.net. 3600 IN NS busk.iana-servers.net. www IN A 127.0.0.1 IN AAAA ::1