Split-horizon DNS: why internal and public lookups differ, and how to monitor both

Split-horizon DNS gives different answers inside and outside your network. How it breaks, how to debug it with dig, and how to monitor the public and internal view.

· 6 min read · By the Spot Downtime team

Split-horizon DNS (also called split-brain or split DNS) means the same name returns different answers depending on who asks. Inside your office, VPN or cloud network, app.example.com resolves to a private address like 10.0.4.20. From the public internet, it resolves to a public IP, or not at all.

It is useful and common. It also produces the classic complaint "it works for me but not for them", and it hides one view from the other. This post covers how it fails and how to monitor each side.

How split-horizon is usually built

  • Two zones for one domain. A public zone at your DNS provider, and an internal zone on a resolver inside the network, such as BIND, Windows DNS, CoreDNS or an Active Directory server.
  • Cloud private zones. For example a Route 53 private hosted zone attached to a VPC, or Azure Private DNS. Queries from inside the VPC see the private zone, and everyone else sees the public one.
  • Resolver overrides. A router or Pi-hole returning a LAN address for a name that is public elsewhere.

The key rule: an internal zone that exists replaces the public one for every name under it, not just the names you defined. If the internal example.com zone lacks www, internal users get NXDOMAIN for it even though the public zone has the record.

The failures it causes

The missing record in the internal zone

Someone adds a record to the public zone and forgets the internal copy. The site works for customers and fails for staff, or the other way around. The symptom is NXDOMAIN on one side only.

Private IPs leaking to the public

A private address copied into the public zone makes the name unreachable from outside. Visitors see timeouts, such as ERR_CONNECTION_TIMED_OUT, because 10.x.x.x goes nowhere from the internet.

Clients using the wrong resolver

A laptop on VPN with a public resolver such as 1.1.1.1 configured manually never asks the internal one, so internal names fail. Browsers using DNS over HTTPS can bypass the corporate resolver in the same way.

Stale internal copies

You moved the site to a new IP, updated the public zone, and forgot the internal zone. Staff keep reaching the old server. See DNS TTL explained for why caches make the timing worse.

Debug it by asking each resolver directly

Query the internal and public resolvers explicitly and compare:

bash
# Public view
dig +short app.example.com @1.1.1.1

# Internal view (use your resolver's address)
dig +short app.example.com @10.0.0.2

# What does this machine use by default?
resolvectl query app.example.com    # systemd-resolved
scutil --dns | head -30             # macOS

If the answers differ, check which one is wrong. Also ask the authoritative servers directly to rule out the public zone:

bash
dig NS example.com +short
dig app.example.com @ns1.your-dns-provider.com
DNS lookupSee what the public internet resolves for any name, which is what your customers see.

Monitoring the public view

An external monitor sees the public view by design: it resolves your name the way any visitor does. Spot Downtime checks from Virginia, Amsterdam and Singapore and confirms every failure from all three before alerting. That makes it a good test of the public zone, including the "private IP leaked to the public" mistake. A DNS monitor on the record also alerts you when the answer changes from what you expect, which catches an accidental edit to the public zone. Read how to monitor DNS records for the setup.

External monitors can't see inside

A check from the public internet never uses your internal resolver. If the internal zone breaks, an external monitor stays green. Likewise, a service that exists only on a private address is not reachable from outside, so it needs a different approach.

Monitoring the internal view

For the inside, run a small check from inside the network and report in with a heartbeat. A cron job on an internal host can resolve the name against the internal resolver, compare it to the expected address, and ping a heartbeat monitor only when it matches:

bash
#!/bin/sh
# Runs every 5 minutes from a host inside the network
EXPECTED="10.0.4.20"
GOT=$(dig +short +time=3 +tries=1 app.example.com @10.0.0.2 | head -n1)

if [ "$GOT" = "$EXPECTED" ]; then
  curl -fsS -m 10 --retry 2 https://YOUR-HEARTBEAT-URL > /dev/null
fi

If the internal answer is wrong or the resolver is down, the ping is skipped and the heartbeat alerts you that it is overdue. The setup is explained in how to set up a heartbeat monitor. The grace period should be a little longer than the cron interval, as described in heartbeat grace period and interval.

Keep the two zones in step

  1. Keep zone files in version control and generate both views from one source where you can.
  2. List which names are public-only, internal-only and both. Review it when adding a record.
  3. Never put RFC 1918 addresses (10.x, 172.16-31.x, 192.168.x) in a public zone.
  4. After any DNS change, query both resolvers and compare, as above.
  5. Lower the TTL before planned changes so mistakes clear faster.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading