====== Networking - DNS - Unbound - Local Data ====== Local data, which can override A / AAAA addresses, can be configured to reply to DNS queries. The format for local-data is: local-data: "" **NOTE:** * The query has to match exactly unless you configure a local-zone as **redirect**. * If not matched exactly, the local-zone type determines further processing. * If local-data is configured that is not a subdomain of a local-zone, a transparent local-zone is configured. * For record types such as **TXT**, use single quotes, as in local-data: 'example. TXT "text"'. **NOTE:** local-data is often associated with a [[Networking:DNS:Unbound:Local Zones|local-zone]] local-zone: local-data: "" 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" ---- ===== Examples ===== ^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."| | ---- ===== References ===== https://nlnetlabs.nl/documentation/unbound/unbound.conf/ https://fossies.org/linux/unbound/doc/example.conf.in