0

I would like to use our internal DNS server for linking names from provisioning to final use. So I imagine it like this.

A server comes into our network and gets a DHCP or a static address and then has a DNS entry with its hardware name, for example ilocz1234xyz with an HP server. Later the server is provisioned and gets a name and a function in the process. I would like to merge these names. we are currently doing this by giving the server a name during provisioning, for example pegasus in the DNS we then create the names:

  • ilocz1234xyz.example.com
  • ilo.pegasus.example.com
  • pegasus.example.com

After that, the server is installed by the OP team with a specific role and gets a working name, for example "webserver" and the DNS entries are adjusted:

  • ilocz1234xyz.example.com
  • ilo.pegasus.example.com
  • pegasus.example.com
  • webserver.example.com

My question now is how do I get the names to be referenced, so that I can see the names belong together. I initially thought it like this:

  • ilocz1234xyz.example.com A record -> 10.0.0.100
  • ilo.pegasus.example.com C-NAME -> ilocz1234xyz.example.com
  • pegasus.example.com A record -> 10.0.0.200
  • webserver.example.com C-NAME -> pegasus.example.com

My goal now is that I can make a query on pegasus.example.com and then get the entries for ilo.pegasus.example.com and webserver.example.com but that doesn't work because CNAME is just an alias and I cannot search DNS recursively. You could certainly also write a script that queries the DNS and collects all the data for me, but my question is whether there is an easier way to solve this, maybe even with on-board tools.

kockiren
  • 886
  • 2
  • 14
  • 35

1 Answers1

1

There is no generic way in DNS to do that. It wasn't designed with that kind of enumeration of back references in mind. Think about generic Linux file systems: there is no way to collect all symlinks pointing at some object other than scan the whole directory tree.

However, you can build your own solution on top of DNS. For example, when you add or removee CNAME (which is "forward reference"), at the same time edit the TXT record to control the "back reference":

name.example.com. A 192.0.2.1
name.example.com. TXT "CNAME:some-alias.example.com CNAME:another-alias.example.org"
some-alias.example.com. CNAME name.example.com.

another-alias.example.org. CNAME name.example.com.

or that record could be called _back-reference.name.example.com. or something like this. You choose.

I don't know anything about tools which already implement this, but it is not hard to do.

Nikita Kipriyanov
  • 8,033
  • 1
  • 21
  • 39