I'm planning to migrate my domain's DNS from one provider to another. ("mydomain.com" as I have to censor the real name) Technically, it's just a matter of changing the NS records before the registrar change, but I'd like to make sure I didn't miss some domains by spoofing the DNS server on my local machine and testing.
I first tried changing my /etc/resolv.conf to "nameserver 2.22.230.67" (it's one of the new nameservers), but it no longer returns anything for CNAME entries pointing to different domains (edgekey.net):
$ dig +short login.mydomain.com
prod.mydomain.com.edgekey.net.
$ dig +short prod.mydomain.com.edgekey.net
e8727.dscx.akamaiedge.net.
$ dig +short e8727.dscx.akamaiedge.net
$
I then tried to install and configure bind but quickly gave up, and tried again with dnsmasq with this entry:
server=mydomain.com/2.22.230.67
The problem was not resolved although dnsmasq correctly resolves CNAMES if I manually ask it by issuing multiple queries:
$ dig +short login.mydomain.com
prod.mydomain.com.edgekey.net.
$ dig +short prod.mydomain.com.edgekey.net
e8727.dscx.akamaiedge.net.
104.84.78.23
$ nslookup login.mydomain.com
Server: 127.0.0.1
Address: 127.0.0.1#53
login.mydomain.com canonical name = prod.mydomain.com.edgekey.net.
prod.mydomain.com.edgekey.net canonical name = e8727.dscx.akamaiedge.net.
Name: e8727.dscx.akamaiedge.net
Address: 2a02:26f0:2b00:396::2217
Name: e8727.dscx.akamaiedge.net
Address: 2a02:26f0:2b00:3a9::2217
$ ping login.mydomain.com
ping: login.mydomain.com: Name or service not known
Am I doing something wrong or expecting too much from dnsmasq?
I have already given up and launched the next steps, migrating the DNS and test in production, but I'm still curious as to how I should have tested that.
If I were on windows 10, I could probably try the powershell command Add-DnsClientNrptRule which very much looks like what I need, but for now I'd like a solution for Linux.