How to use CNAME to external hosts on local DNS Server

domain-name-systeminternal-dnswindows-server-2012

I have a domain mydomain.com and I'm using an external DNS Server to resolve some names like www.mydomain.com and webmail.mydomain.com on Internet.

Now, I need to create a rule, only on my LAN, to resolve newserver.mydomain.com to newserver.cloudapp.net (a new server hosted at Azure).

At first I tought, "I can create a CNAME entry on my local DNS Server and the job is done!" but to do it I had to create another zone to resolve *.mydomain.com and all went wrong. My DNS server was able to resolve newserver.mydomain.com but all other URLs were unavailable… of course, my local DNS server became "authoritative" for that domain.

I'm using Windows Server 2012, and I only want to configure my DNS Server to do this:

Resolve this entry:

newserver.mydomain.com CNAME newserver.cloudapp.net

and

*.mydomain.com still resolving on external DNS Server.

How can I do that?

Thanks in advance! 😉

Best Answer

You do not have to create an internal zone example.com which overrides the whole domain, create an internal zone for a subdomain newserver.example.com authoritative for *.newserver.example.com and the zone name itself without any prefix i.e. newserver.example.com.

Since you're using this only in your internal DNS you have, I think, an edge case, where you don't necessarily run into this problem and can still do:

# zone for newserver.example.com.
@  IN CNAME newserver.cloudapp.net.

and don't have to do

# zone for newserver.example.com.
@  IN A  <the_ip-address_of_newserver.cloudapp.net.> 

which is the alternative.