[Dnsmasq-discuss] Go to /etc/hosts for target of a CNAME

Dominick C. Pastore dominickpastore at dcpx.org
Fri Aug 24 21:14:21 BST 2018


I would like to to configure Dnsmasq so that when it receives a CNAME record, if the target is in /etc/hosts, it overrides whatever else the public DNS server says about that target and uses /etc/hosts instead. Is this possible? After studying the manual, it seems like not, but I'm wondering if I missed something.

Here's why:
I have split-horizon DNS set up and the router runs Dnsmasq. Within the network, host.cityname.dcpx.org points to the host's private IP address, and outside the network, the public DNS record for that name points to the router's external IP address. For convenience, I created a public CNAME record for host.dcpx.org -> host.cityname.dcpx.org.

This CNAME record works well across the Internet, but behind the router, not so much. Dnsmasq goes to the public DNS server for the CNAME record, which also has the public A record for the canonical name. Once Dnsmasq has to hit the public DNS server, it seems to take all of its word as law, and returns the external A record to the client that's inside the network. Even though it has an entry in /etc/hosts for the same name.

I saw the --local=/cityname.dcpx.org/ and --auth-zone=cityname.dcpx.org options and got hopeful that one of those would fix my problem, but unfortunately, neither did.


More information about the Dnsmasq-discuss mailing list