[Migrated from tuzig.com]
This is something I thought would be simple. Then I began scratching my head reading all the posts on the web, thinking I might actually need to get a proper book. Finally I realised it was actually quite simple…
This is not the classic split DNS (aka split-brain dns) functionality, but in my setup I needed something similar. Let me explain:
I have one domain (lets call it gingerlime.com) and I have both external and internal hosts that I would like to access via XXX.gingerlime.com.
The external DNS happily resolves all external host records. In the gingerlime offices, however, I use the same external records, but we also want to use internal resolution e.g. internal-server.gingerlime.com. In some cases, I may want to use the same name for internal and external servers, so when people use it in the office they get to the internal host, and when out (you guessed it…) to the external.
That’s easy to manage if you define the domain internally, say set gingerlime.com on our internal dns server – running on windows 2003, and then define each host whichever way you like. However, the main problem and pain was that every time a record needed to be updated, or a new one created, I needed to update both the external and internal dns servers. What I wanted was to have all names resolved externally, apart from those ones which we want to access internally only or to override.
The solution is surprisingly simple. Instead of creating a dns zone for gingerlime.com on our internal server, I created a zone for each host we needed to override, i.e. a zone for internal-server.gingerlime.com. Then all I had to do was to create an empty A (or CNAME) record to resolve to whichever IP (or dns record) I wanted.
I then made sure to delete the zone for the upper-level domain (gingerlime.com), so resolution of any unknown gingerlime.com record gets forwarded to the external dns, and any known one (you guessed it again…) resolves locally.