A coredns plugin for dispatch request to other upstream by matched domain.
dispatch FROM... {
to TO...
healthcheck DURATION
maxfails INTEGER
}
-
FROM...
is the file list which contains base domain to match for the request to be redirected. URL can also be used..
(i.e. root zone) can be used solely to match all incoming requests as a fallback.Two kind of formats are supported currently:
-
DOMAIN
, which the whole line is the domain name. -
server=/DOMAIN/...
, which is the format ofdnsmasq
config file, note that only theDOMAIN
will be honored, other fields will be simply discarded.
Text after
#
character will be treated as comment.Unparsable lines(including whitespace-only line) are therefore just ignored.
-
-
to TO...
are the destination endpoints to redirected to. This is a mandatory option.The
to
syntax allows you to specify a protocol, a port, etc:[dns://]IP[:PORT]
use protocol specified in incoming DNS requests, it mayUDP
orTCP
.[udp://]IP:[:PORT]
useUDP
protocol for DNS query, even if request comes inTCP
.[tcp://]IP:[:PORT]
useTCP
protocol for DNS query, even if request comes inUDP
.tls://IP[:PORT][@TLS_SERVER_NAME]
for DNS over TLS, if you combine:
and@
,@
must come last. Be aware of some DoT servers require TLS server name as a mandatory option.json-doh://URL
use JSONDNS over HTTPS
for DNS query.ietf-doh://URL
use IETF(RFC 8484)DNS over HTTPS
for DNS query.doh://URL
randomly choose JSON or IETFDNS over HTTPS
for DNS query, make sure the upstream host support both of type.Example:
dns://1.1.1.1 8.8.8.8 tcp://9.9.9.9 udp://2606:4700:4700::1111 tls://[email protected] tls://8.8.8.8 tls://dns.quad9.net doh://cloudflare-dns.com/dns-query json-doh://1.1.1.1/dns-query json-doh://dns.google/resolve ietf-doh://dns.quad9.net/dns-query
.:53 {
dispatch https://expample.com/dnsmasq-dns.conf custom-domain.conf {
to 1.1.1.1 tls://[email protected]
healthcheck 10s
maxfails 5
reload 24h
}
dispatch home.conf {
to 10.1.1.10:53
}
forward . 8.8.8.8
}