Local data, which can override A / AAAA addresses, can be configured to reply to DNS queries.
The format for local-data is:
local-data: "<resource record string>"
NOTE:
local-data: 'example. TXT "text"'.
NOTE: local-data is often associated with a local-zone
local-zone: <zone> <type> local-data: "<resource record string>"
If you configure local-data without specifying local-zone, by default a transparent local-zone is created for the data.
You can add locally served data with:
local-zone: "local." static local-data: "mycomputer.local. IN A 192.0.2.51" local-data: 'mytext.local TXT "content of text record"'
You can override certain queries with:
local-data: "adserver.example.com A 127.0.0.1"
You can redirect a domain to a fixed address with:
# This makes example.com, www.example.com, etc, all go to 192.0.2.3. local-zone: "example.com" redirect local-data: "example.com A 192.0.2.3"
You can also add PTR records using local-data directly (“ipv4 name” or “ipv6 name”), but then you need to do the reverse notation yourself:
local-data-ptr: "192.0.2.3 www.example.com"
Type | Example | Comment |
---|---|---|
CNAME | local-data: “alias 3600 IN CNAME host.example.org.” | Only 1 CNAME per name, otherwise the client will not be able to resolve it (does not allow multiple entries like an A) |
MX | local-data: “my.localdomain. MX 10 mail.example.org.” | “@” Is not acceptable for unbound - replace the domain's FQDN instead. Unbound does not use the default domain in this specific case. |
SRV | local-data: “_sip._tcp 60 IN SRV 0 5 5060 pbx.example.org.” |