Domain-specific DNS server on your Macbook Pro

Jamie Duncan
3 min readNov 12, 2019
DNS is hard. all. the. time.

I recently moved to a Macbook Pro for my primary work laptop. I keep a Fedora 31 laptop handy, and I have a decent-sized home lab to doing Linux-y things. For browsing and surfing thoughs, a Macbook is a pretty good experience.

My home lab is what caused me to have to dig this up. My home network is Ubiquiti hardware, and it automatically manages my internal DNS zones and hostnames. I ❤ it. On my Linux laptop, I would quickly configure dnsmasq and be done with it.

But my work laptop automatically connects to my work VPN. Because my employer manages my configuration remotely, how can I have my home lab domain, int.jduncan.io not get pushed out to public servers for resolution where it will fail? Turns out, it’s really easy to set specific DNS resolvers for various domains.

First, check out your DNS configuration using $ scutil --dns . You’ll see a lot of different resolvers configured. In my case resolver #1 is what is handling my DNS lookups, then #2 handles the .local domain. Resolver #3 is the reverse lookup for the 169.254 APIPA address space, and so on. The root DNS servers for the internet are also listed.

scutil --dns
DNS configuration
resolver #1
search domain[0] : vmware.com
search domain[1] : eng.vmware.com
nameserver[0] : 10.84.54.30…

--

--

Jamie Duncan

App Transformation & GCP @Google. Formerly VMW & Red Hat. Father. Woodworker. F1 Fan. Shitposter.