Skip to content

Hosts files

ernolf edited this page Sep 26, 2026 · 4 revisions

Hosts files

dcm keeps its host records in a directory, not in a single file: addn-hosts = /etc/dnsmasq.d/hosts makes dnsmasq load every file in it, which is what lets one page of the UI own one file.

File Page Owner Purpose
hosts/local Hosts www-data LAN hosts, including one entry per cluster node
hosts/vms Virtual Machines www-data virtual-machine records, relocatable between subnets
hosts/isolated Isolated Hosts www-data phone-home endpoints pinned to 127.0.0.1 and ::1

All three are ordinary dnsmasq hosts files — one <ip> <name> record per line, # disables a line. The UI's add, edit, enable/disable and delete actions write exactly that, and lines it does not own (a hand-written comment header, for instance) stay untouched. All three are synced to every node.

hosts/local — and why the nodes belong in it

hosts/local must contain one line per node mapping its hostname to its IP — dcm-cli reads these to generate each node's listen.conf:

192.168.189.1    castor
192.168.189.101  pollux

That is the single source of truth for the listen addresses: no node IP is written into dcm itself, and listen.conf is the one file never copied between nodes — it is regenerated locally after every sync.

hosts/vms — subnet relocation

VMs in hosts/vms keep a fixed last octet across all networks. When the laptop connects to a different network, one click in vms.php replaces all IP prefixes while preserving last octets.

192.168.78.40  iason     →   10.1.10.40  iason
192.168.78.50  orpheus   →   10.1.10.50  orpheus
192.168.78.84  atalante  →   10.1.10.84  atalante
192.168.78.85  hylas     →   10.1.10.85  hylas

(Interim solution: a future version will drop manual relocation and auto-detect the network, so a VM is always reachable by name no matter which connected network it is started in.)

hosts/isolated — quarantined names

Software phone-home endpoints (e.g. the license-check servers of Acronis, Adobe, …) pinned to 127.0.0.1 and ::1 so those lookups fail silently. This is not an ad-blocking list; ad-list blocking is a separate, still-planned feature (see Roadmap).

Both families are needed: a client that gets 127.0.0.1 for an A query but a real address for AAAA still reaches the endpoint. The page therefore shows one row per name set and writes two lines per row, so a name is entered, edited, disabled and deleted once while the file stays a hosts file that can be copied into a system hosts file as it is:

127.0.0.1        activation.acronis.com
::1              activation.acronis.com

The field below the table takes a whole list at once: bare names, one per line, or lines copied straight out of a hosts file, in which case the leading redirect IP and a trailing comment are ignored. Names the file already carries are reported as such instead of being added twice, so pasting a list that contains every name twice — once per family — imports each name once.

A line redirecting to anything other than 127.0.0.1 or ::1 is not dcm's to rewrite: it is listed read-only below the table.

Hosts files versus address=

A hosts file answers per name, and a name it knows wins over an address= line covering the same domain. address= answers a whole domain from one fixed address and belongs to the Fixed Addresses page; since dnsmasq 2.86 it needs a matching local=/domain/ to keep other query types from being forwarded upstream. Both rows are documented in Directive catalog.

dcm

Getting started

Managing the cluster

Under the hood

What comes next

Clone this wiki locally