Injecting DNS records for a domain on your DNS server for local domain clients

dns-hostingdns-zonedomain-name-systeminternal-dnsnameserver

I have a Microsoft DNS server setup and running for my local domain (mydomain.local). I have set up a public domain since then (mydomain.com) and want all my local clients to have different A hosts for mydomain.com while they are on the local network. If they are remote I want them to get the resolutions anyone would get on the internet from the public DNS server (hosted elsewhere).


Scenario 1: Internal

client1.mydomain.local is a PC on my local network and tries to resolve test.mydomain.com. That client should get back 192.168.1.100. When the client tries to resolve test2.mydomain.com it should get back 192.168.1.101. Then last when the client tries to resolve test3.mydomain.com it should get back 8.8.3.6.

Scenario 2: External

client2 is a PC somewhere else in the world and tries to resolve test.mydomain.com. That client should get back 8.8.3.4. When the client tries to resolve test2.mydomain.com it should get back 8.8.3.5. Then last when the client tries to resolve test3.mydomain.com it should get back 8.8.3.6.


Currently I have my local DNS server (mydomain.local) setup with the new domain (mydomain.com) and only have a few select A hosts in it (test, test2 but NOT test3). My goal is to somehow forward the DNS requests to a specific DNS server that are not in my (mydomain.com) zone. At this point when I try to resolve test1.mydomain.com and test2.mydomain.com they resolve great! But when I try to resolve test3.mydomain.com it fails and does not resolve.

Best Answer

OK I found two methods of doing what I want...

Method #1: Zone Per Host

This method is crude and somewhat messy if you have a bunch of hosts you need to work with, but in my case I only had a few so it worked great for me and this is the method I went with...

First you have your DNS zone hosted with a third party (in my case it was with Godaddy). This is what is used for the public (internet) to resolve test.mydomain.com and the clients on the internet side would get back 8.8.3.4. That's what I already had in place and now I need my internal network to resolve those hosts differently. So I did the following...

Create a new zone on your local network DC called "test.mydomain.com". In that zone create an "A-Host" record, do not enter anything into the first field called "Name", just leave it blank. Then enter your LOCAL internal IP in the "IP Address" field. In my case I used "192.168.1.100".

Now I test with a client on the internet (outside the office) and test.mydomain.com resolves to 8.8.3.4! And the client on my local network resolves test.mydomain.com to 192.168.1.100!!!


Method #2: Two Zones, One For Internal And One For External

This is the less messy way of doing it but requires more upkeep. In this method you will need to keep multiple zone in multiple locations up to date. I chose not to go this route just because of the upkeep. If you have a bunch of hosts and want a clean look this might be the method for you.

Create a new zone on your local network DC. Call the zone "mydomain.com". Now replicate manually all the records from the (in my case GoDaddy hosted) zone to the newly created zone in your local DC. Once you have done that just change the records you want to be different for internal use. This in essence kinda hijacks the zone. So if you hop on godaddy and update the zone with a new a-host or change an existing one you will need to do the same thing on your local DC server to reflect the changes.

Related Topic