Last month I wrote about the VM side of my split-horizon DNS problem — the client that couldn’t resolve its own blog. This is the other half of the story: the router side. My gateway is a UniFi Dream Machine, and everything the resolver on the VM saw traces back to decisions made in the UDM’s DNS configuration.
The short version of the setup: the UDM hands out DNS to every LAN client, so it is the resolver for the whole network. It answers local names from its own records and forwards everything else upstream. That single design choice is what makes split-horizon work — and also what makes it fail in confusing ways when a record goes missing. What follows is how I verify the router side, with real output from my network this week.
1. Know who actually answers
The first step is confirming which resolver a client is really using. On my VMs it’s systemd-resolved, pointed at the gateway:
resolvectl status
# Link 2 (ens18)
# Current DNS Server: <router-dns-address>
# DNS Servers: <router-dns-address>
That matters more than it sounds. When I ran the original blog-unreachable investigation, the resolver on the affected VM returned SERVFAIL for the site’s apex name while the router itself answered fine for the www name. Same network, two different answers, because two different layers were involved. Before touching any record, I pin down the answering server with dig‘s SERVER line:
dig www.<site-domain> +noall +comments | grep SERVER
2. The router is authoritative for what it knows, and a forwarder for everything else
The UDM runs a local DNS zone for names it has records for and forwards everything else to upstream resolvers. The distinction shows up clearly in status codes. From a LAN client, querying the router directly:
# A name with a local record on the router — answered locally:
dig +short unifi.<lan-domain> @<router-dns-address>
<internal-address>
# A public name — forwarded upstream, answered with public IPs:
dig +short www.<site-domain> @<router-dns-address>
104.x.x.x
172.x.x.x
Both queries went to the same server. One hit the local zone, one hit the forwarder. That’s the split horizon in action: one resolver, two answers depending on whether the name has a local record.
3. The failure mode: NOERROR with no answer
This is the part that cost me an afternoon. When I checked names that used to have local records — the reverse-proxy hostname and the NAS — the router answered, but with nothing:
dig npm.<lan-domain> @<router-dns-address> +noall +comments
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34750
# (no answer section)
NOERROR with an empty answer is NODATA: the server processed the query without an error and has no record. It is not NXDOMAIN (“this name doesn’t exist”) and it is not SERVFAIL (“I couldn’t complete the lookup”). Reading the status code instead of just looking for “did it resolve” is the difference between knowing the record is gone versus the resolver being broken.
Meanwhile, going through the systemd-resolved stub instead of hitting the router directly gave me SERVFAIL for the same name:
resolvectl query npm.<lan-domain>
# npm.<lan-domain>: resolve call failed: Could not resolve 'npm.<lan-domain>',
# server or network returned error: SERVFAIL
Same name, two symptoms. The stub resolver adds its own handling on top (search-domain processing, caching, retry behavior), so the error it surfaces isn’t always the raw upstream status. When the direct query says NODATA and the stub says SERVFAIL, believe the direct query — it’s closer to what the router actually said.
The root cause here was mine: those local records were defined under an old domain that got retired in a migration. The records were never recreated under the new name, so the router now answers “I know the zone, there’s no such record.” The lesson generalizes: after any domain or naming change, re-verify every local record, not just the ones in the request path that day.
4. CNAME chains: one broken link breaks the whole lookup
My proxy hostname is a chain: npm.<site-domain> is a CNAME pointing at the NAS, which itself resolves locally. Two links, and the lookup only succeeds if both resolve. That’s worth verifying link by link:
dig +short npm.<site-domain> CNAME @<router-dns-address>
dig +short <chain-target-name> A @<router-dns-address>
If the first query returns a CNAME and the second comes back empty, you’ve found the broken link — the resolver got the alias but nothing to point it at. This is also why a CNAME to a public name that only resolves externally can behave strangely for internal clients that can’t reach external DNS cleanly. Flat local records (direct A records) avoid the chain entirely, at the cost of one more thing to update when an address changes.
5. Test from more than one resolver
My network has three DNS perspectives: the UDM on the LAN, Tailscale’s MagicDNS on the tailscale0 interface, and whatever public resolver the upstream forwarder uses. Each can have a different answer for the same name, and troubleshooting from only one of them guarantees you’ll miss a split-brain. My quick matrix:
GW=$(ip route | awk '/default/ {print $3}')
for n in www.<site-domain> npm.<lan-domain> <nas-name>.<lan-domain>; do
printf '%-30s lan=%s ts=%s ext=%s\n' "$n" \
"$(dig +short $n @$GW | tr '\n' ' ')" \
"$(dig +short $n @100.100.100.100 | tr '\n' ' ')" \
"$(dig +short $n @1.1.1.1 | tr '\n' ' ')"
done
Anything that should answer identically everywhere but doesn’t is either a deliberate local override (fine — that’s the split horizon working) or a stale record (not fine). Writing down which is which, once, saves the next investigation entirely.
6. Keeping the router side honest
- Enumerate the local records periodically. I keep a short list of every name that must resolve internally — proxy, NAS, home automation, the UDM itself — and check them with
digon a schedule. NODATA on any of them is a finding, not a curiosity. - Prefer explicit records over inherited assumptions. DHCP hostnames show up in the UDM’s local DNS automatically, but anything a service depends on should be a deliberate record. Automatic entries move when leases move.
- Match records to certificates. A reverse proxy with Let’s Encrypt certs needs the public name to resolve correctly both internally (for clients) and externally (for the ACME challenge). Split horizon is exactly where those two requirements meet.
- After changing a record, flush the client cache —
resolvectl flush-caches— and re-run the same queries. Flushing before fixing the record just proves the old answer is cached; flushing after proves the new one propagates.
Wrapping up
The router side of split-horizon DNS is not complicated, but it is easy to get wrong quietly. A missing record produces no error anywhere — the router answers politely with nothing, the stub resolver translates that into a SERVFAIL, and every downstream layer (proxy, TLS, WordPress) gets blamed first. Check the status code, query the router directly, and compare resolvers. The answer is almost always in which server said what.