How I Stopped Chasing DNS and Gained Faster Local Dev with Split DNS

Stop editing /etc/hosts and chasing flaky API endpoints—how I used a simple split DNS setup (Pi‑hole + conditional zones) to speed local development.

Written by: Rohan Deshpande

Close-up of coloured network cables plugged into a switch, lit in warm light
Image credit: Markus Spiske / Unsplash

A few months into a cross‑team project, my laptop started feeling like the worst kind of flaky teammate: one minute staging was reachable, the next it resolved to a public IP and timed out, and CI jobs kept failing because they hit the wrong environment. I found myself toggling /etc/hosts, VPNs, and temporary curl flags more often than shipping features.

The fix that actually stuck was embarrassingly simple: run a split DNS at home. I set up Pi‑hole (in a Docker container on a cheap NUC), defined a few conditional zones for staging and internal services, and made my router hand that DNS to every device. Suddenly staging.example.com always pointed to the internal IP I expected, feature flags loaded from local mocks, and I stopped copying host entries between machines.

What split DNS did for me

How my setup looks (practical, minimal)

The key idea: make Pi‑hole answer all the DNS queries, but for internal names it hands back local IPs. Everything else is forwarded upstream as usual. This is split DNS: the resolver returns internal answers for specific zones and external answers for everything else.

A tiny, real config example

If you prefer the command line, adding a local zone in a dnsmasq conf looks like:

Hands on tips that saved me time

Tradeoffs and real annoyances

Why this beats the alternatives for day‑to‑day dev Compared to using per‑machine /etc/hosts entries or constantly toggling VPNs, split DNS gives you a single source of truth that’s visible to everyone on the same network. It’s much cleaner than running individual mocks on every laptop, and cheaper and faster than provisioning cloud DNS zones for ephemeral testing environments.

When not to use it If your org already has a corporate split DNS controlled centrally, or if security rules forbid local DNS changes, don’t reinvent the wheel. Also, for purely remote-first teams where everyone is on different networks (and you can’t control DNS), a CI‑driven stub resolver or staged environments in the cloud might be a better fit.

If you’re curious and have 90 minutes

It’s small infrastructure, but it changes the rhythm of work. I went from constantly chasing misrouted API calls to being able to trust a name—and that saved me more than the 90 minutes it took to set up.

Give it a try on a quiet weekend. If you hit the usual pitfalls (DoH, cached records, VPN strangeness), that’s normal; each one is a teachable moment for team docs. And if you get stuck, ping me—I’ve had most of those headaches already.