I am trying to use dnsmasq to resolve certain known domains using its configuration, but let the rest of the requests go through to the normal DNS server assigned by DHCP. I cannot get this to work. When I set DNS to 127.0.0.1 through the Network panel, I have to hardcode the DHCP assigned DNS servers to dnsmasq's configuration. However, when I'm on a different network, e.g. at work, at a client, these addresses are different. I have to reconfigure anytime I change networks.
How can I configure OS X to use 127.0.0.1 AND any DNS servers assigned through DHCP?
If that is not possible, then how can I tell dnsmasq to obtain upstream DNS servers through DHCP?
Here's what I know so far.
/etc/resolv.conf on OS X is dynamic, it changes according to what you set in the Network preferences, or using DHCP. It changes anytime you reconnect. It's even deleted when you go offline. So as soon as I use 127.0.0.1 this is reflected in /etc/resolv.conf and I don't know if there is any place where the formerly DHCP-assigned DNS addresses can be found.
OS X doesn't use /etc/resolv.conf.head.
OS X doesn't use /etc/dhclient.conf where you can prepend DNS servers to the DHCP provided list.
/etc/resolver/tld.conf is not a solution, because that tries to use a DNS server based on matching a tld (it's good if you use .dev or something).
Edit: There is a screenshot of the Network DNS setting here that looks like what I want, but I have no idea how the author of that article achieved.