Difference between revisions of "CoreDNS"

From UVOO Tech Wiki
Jump to navigation Jump to search
Line 23: Line 23:
 
- https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb
 
- https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb
 
- https://github.com/openmohan/lightdns
 
- 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
 +
```

Revision as of 01:55, 19 October 2020

Compile with unbound

Add unbound:github.com/coredns/unbound to plugin.cfg.
Do a go generate, followed by make.

Golang

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