Local DNS

DNS and DHCP → Local DNS holds the names the appliance’s resolver answers by itself, for every client that asks it, without asking anyone else. Typical…

What it is for

DNS and DHCP → Local DNS holds the names the appliance’s resolver answers by itself, for every client that asks it, without asking anyone else. Typical uses:

  • giving a name to an internal device: nas.johnsmith.test → 192.168.10.20, nvr.johnsmith.test → 192.168.10.30;
  • split DNS: the public name of a published service (www.johnsmith.test) that from inside resolves to its internal address (192.168.10.40). It is the alternative to hairpin NAT for reaching a published service from inside (see Published services and the scenario Reaching a published service from inside).

The records work only while DNS protection is on: it is the appliance’s resolver that serves them. If it is off, the block says so in yellow (“DNS protection is off: these records are saved but not answered until it is on.”) with the link to “DNS protection”.

In the example company there are five records: argos.johnsmith.test → 192.168.10.1 (the console), nas.johnsmith.test and nas → 192.168.10.20, mail.johnsmith.test → 192.168.10.25, nvr.johnsmith.test → 192.168.10.30 and www.johnsmith.test → 192.168.10.40.

Local DNS with the headquarters recordsLocal DNS with the headquarters records
Local DNS with the headquarters records

How the page is laid out

The block has “Reload” in its bar and, at the far right, “Add record”. Below a short explanation comes the list of records: the names in bold, below them the address and the comment; on the right the “Edit record” and “Delete record” buttons. Clicking a row opens it as “Edit record”.

The dialog has three fields:

Field What it does Rules
“Address” The address the names answer with required; IPv4 or IPv6
“Names” One or more names, separated by spaces; the first is the canonical one required; valid host names; neither localhost nor the system’s IPv6 names
“Comment” A note optional, one line

The buttons are “Cancel” and “Add” (or “Save” for an existing record). Every change is saved at once: there is no “Save” for the block. The message is “Local DNS saved”. Deleting asks for confirmation (“Delete the record …? The resolver stops answering it at once.”).

How they are served

  • For each name the resolver answers with an A record (IPv4) or an AAAA record (IPv6); for each address it also answers the reverse lookup (PTR), with the first name of the first record that uses it.
  • Use full names. A single-label name (nas) answers only nas., while clients usually append their search domain and ask for nas.johnsmith.test. To have both, write nas.johnsmith.test nas.
  • A record inside a blocked domain answers all the same: the rest of the domain stays blocked.
  • The records are also written into argos’s block of /etc/hosts, so the appliance itself resolves them whatever DNS it uses. The rest of /etc/hosts stays as it is.
  • A record may name the appliance itself (in the example argos.johnsmith.test → 192.168.10.1): it is split DNS for the console, and the console answers under that name too. In /etc/hosts the appliance’s own names stay on its own line anyway, the one the host’s identity writes.

Error messages

Message Meaning
“Required” The address is missing
“Not a valid IPv4 or IPv6 address” The address is not valid
“An address needs at least one name” The name is missing
“Not a valid host name” A name contains characters that are not allowed (letters, digits, inner hyphens and dots between labels are)
“localhost and the IPv6 standard names belong to the system: they are never moved” You used a reserved name
“Saved — DNS protection is off, so nothing answers them yet” Warning: saved, but the resolver is off
“Saved, but the resolver did not take them” The record is saved but Unbound refused the configuration: the resolver carries on with the previous one

For the technician The records become local-data and local-data-ptr lines of the Unbound snippet. In /etc/hosts argos owns only its own marked block and the 127.0.1.1 lines of the appliance’s name; localhost, the system’s IPv6 lines and your own lines stay untouched. A name the block defines is removed from a foreign line that mapped it elsewhere, because the system would use the first match.

LET’S TALK INFRASTRUCTURE

Control starts with a conversation.

Tell us about your infrastructure. Let’s start with what you actually need.

Talk to an engineer