Discussion:
[Dnsmasq-discuss] Go to /etc/hosts for target of a CNAME
Dominick C. Pastore
2018-08-24 20:14:21 UTC
Permalink
Hello,

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.

Thanks,
Dominick
Simon Kelley
2018-08-24 21:34:26 UTC
Permalink
If I've understood the situation correctly, the solution is to replicate
the CNAME in dnsmasq

cname=host.dcpx.org,host.cityname.dcpx.org


that way you'll get an answer to the query for host.dcpx.org which a
cname to host.cityname.dcpx.org and an A record for
host.cityname.dcpx.org from /etc/hosts.


Cheers,

Simon.
Post by Dominick C. Pastore
Hello,
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.
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.
Thanks,
Dominick
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Dominick C. Pastore
2018-08-25 14:15:56 UTC
Permalink
Thanks. That was what I came up with as a backup plan, although I was hoping there might be a way where I didn't have to maintain two copies of the CNAME records. That's alright though, I'm glad that should at least work.

Thanks for the advice.

Cheers,
Dominick
Post by Simon Kelley
If I've understood the situation correctly, the solution is to replicate
the CNAME in dnsmasq
cname=host.dcpx.org,host.cityname.dcpx.org
that way you'll get an answer to the query for host.dcpx.org which a
cname to host.cityname.dcpx.org and an A record for
host.cityname.dcpx.org from /etc/hosts.
Cheers,
Simon.
Post by Dominick C. Pastore
Hello,
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.
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.
Thanks,
Dominick
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
_______________________________________________
Dnsmasq-discuss mailing list
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
Loading...