Files
coredns/man/coredns-local.7
2026-06-24 02:31:31 -07:00

89 lines
2.5 KiB
Groff

.\" Generated by Mmark Markdown Processor - mmark.miek.nl
.TH "COREDNS-LOCAL" 7 "June 2026" "CoreDNS" "CoreDNS Plugins"
.SH "NAME"
.PP
\fIlocal\fP \- respond to local names.
.SH "DESCRIPTION"
.PP
\fIlocal\fP will respond with a basic reply to a "local request". Local requests are defined to be
names in the following zones: localhost, 0.in\-addr.arpa, 127.in\-addr.arpa and 255.in\-addr.arpa,
any query under \fB\fC.localhost.\fR, and, by default for backward compatibility, any query prefixed by
\fB\fClocalhost.\fR. When seeing one of the non\-apex localhost forms a metric counter is increased and if
\fIdebug\fP is enabled a debug log is emitted.
.PP
With \fIlocal\fP enabled any query falling under these zones will get a reply. This prevents the query
from "escaping" to the internet and putting strain on external infrastructure.
.PP
The zones are mostly empty, only \fB\fClocalhost.\fR, names under \fB\fC.localhost.\fR, and legacy
\fB\fClocalhost.<domain>\fR names return loopback address records (A and AAAA), and only
\fB\fC1.0.0.127.in-addr.arpa.\fR has a reverse (PTR) record.
.SH "SYNTAX"
.PP
.RS
.nf
local
.fi
.RE
.PP
.RS
.nf
local {
localhost\_prefix on|off
}
.fi
.RE
.PP
\fB\fClocalhost_prefix\fR controls the legacy \fB\fClocalhost.<domain>\fR behavior. The default is \fB\fCon\fR for
backward compatibility. Set it to \fB\fCoff\fR to only treat names under \fB\fC.localhost.\fR as special, which
matches RFC 6761. The legacy prefix behavior is deprecated and may be disabled by default in a
future release.
.SH "METRICS"
.PP
If monitoring is enabled (via the \fIprometheus\fP plugin) then the following metric is exported:
.IP \(bu 4
\fB\fCcoredns_local_localhost_requests_total{}\fR \- a counter of the number of non\-apex localhost
special\-case queries CoreDNS has seen. This includes \fB\fC.localhost.\fR names and, when
\fB\fClocalhost_prefix\fR is \fB\fCon\fR, legacy \fB\fClocalhost.<domain>\fR names. It does \fInot\fP count \fB\fClocalhost.\fR
queries.
.PP
Note that this metric \fIdoes not\fP have a \fB\fCserver\fR label, because it's more interesting to find the
client(s) performing these queries than to see which server handled it. You'll need to inspect the
debug log to get the client IP address.
.SH "EXAMPLES"
.PP
.RS
.nf
\&. {
local
}
.fi
.RE
.SH "BUGS"
.PP
Only the \fB\fCin-addr.arpa.\fR reverse zone is implemented, \fB\fCip6.arpa.\fR queries are not intercepted.
.SH "SEE ALSO"
.PP
BIND9's configuration in Debian comes with these zones preconfigured. See the \fIdebug\fP plugin for
enabling debug logging.